Featured »

January 27, 2019 – 5:29 pm

For some reason I haven’t used zip much on Linux, sticking to the standard tar/gzip combo. But zip seems to be a viable alternative. While not as space-efficient, it is definitely faster; syntax is simple; …

Read the full story »
Networking

Unix and Linux network configuration. Multiple network interfaces. Bridged NICs. High-availability network configurations.

Applications

Reviews of latest Unix and Linux software. Helpful tips for application support admins. Automating application support.

Data

Disk partitioning, filesystems, directories, and files. Volume management, logical volumes, HA filesystems. Backups and disaster recovery.

Monitoring

Distributed server monitoring. Server performance and capacity planning. Monitoring applications, network status and user activity.

Commands & Shells

Cool Unix shell commands and options. Command-line tools and application. Things every Unix sysadmin needs to know.

Home » Archive by Category

Articles in Commands & Shells

Killing Process Network Access

January 27, 2019 – 4:45 pm
IMG_1941[1]

Imagine this scenario: a particular process on your server is connecting to a host outside your internal network and you don’t like that. On the other hand, you can’t just kill that process because you need it.

Installing t CLI power tool for Twitter

January 21, 2019 – 4:41 pm
k0c1xg3f9erebub0aeel9842kih-1[1]

The ‘t’ is an excellent Ruby-based CLI utility for interacting with the Twitter API written by Erik Berlin. This is certainly not the only such tool available, but, in my estimation, it is the most full-featured and expertly-written. No amateur-hour coding here.

Auto-Update /etc/hosts

January 9, 2019 – 4:39 pm
rkhctxih1a1jdqh7x0cgs00ljh5[1]

This was a silly solution to a silly problem, but may come in handy in the future for other things. A user process was establishing frequent connections to a handful of FQDNs. Not having any IP caching capability, every connection attempt was preceded by DNS lookup.

Automating Web Page Screenshots

January 9, 2019 – 4:22 pm
dpu45eapwpze2jks2i1eq930q45

Automatic Web page screenshots are commonly used for various monitoring tasks, such as detecting copyright infringement, website defacement, and other legal and security matters. Automatic screenshotting can also be a useful tool for researchers, developers, and journalists. There are free and open-source tools out there that can help you automate the task of creating Web page screenshots.

AWS CLI Cheat Sheet

August 14, 2018 – 4:18 pm
bb3styfdt6jd861cmp7yt08l1dy

The installation and configuration process for AWS CLI is fairly simple. The package itself is installed with pip (yum -y install python-pip):

Copying X11 Magic Cookies

August 10, 2018 – 4:17 pm
ia2tligtgbuwpu9jmq6i45dw7op

I rarely use GUIs, but when I do, it’s from CLI and every time I run into the annoying MIT-MAGIC-COOKIE-1 data did not match error. It’s easy to fix, but it happens to me so …

Verify Network Port Access

August 8, 2018 – 4:15 pm
q5yhi1e570yliip0lf9srnrm6jh

There are several tools you can use to verify access to a remote network port: nc, tcping, telnet. Unfortunately, nc from the netcat package has been replaced by the one from nmap, which lacks the -z option, making …

Deleting Hidden Files

August 7, 2018 – 4:14 pm
dztxi4tp1w58shuc1r6so6j9y5j

This simplest of problems just never fails to find a new victim. For whatever reason you want to delete all hidden files in the current directory and subfolders. Without much thinking you just type rm …

Quickly Grow tmpfs filesystem

August 6, 2018 – 4:13 pm
217rvcg47is2ea039rna0gdwlnp

Just a quick command to double the size of the /tmp filesystem that uses tmpfs. This is  for those situations when you can’t be bothered to think.

Duck Duck Go Search from Shell

August 5, 2018 – 4:10 pm
xr89tucp33a2bjoopkqf67nq290

The ddgr python script is a command line interface for Duck Duck Go  – a privacy-oriented search engine that, unlike Google, will not give away your data to the likes of Cambridge Analytica. In the …

Document Conversion with Unoconv

August 4, 2018 – 4:08 pm
ygtzk148sim2j4mgau6mkc2uur7

The other day I ran into the “Flexible Import/Export” article by Bruce Byfield in the March 2018 issue of Linux Pro Magazine and thought it could use some more detail. So here’s some more detail.

Obfuscating Shell Scripts

August 1, 2018 – 4:04 pm
dd1gh0yb7yzbkvf8cyjpd4j2adq

Unix shell scripting language is run by the command-line interpreter and, as such, can be read and understood by anyone with sufficient access and experience. Sometimes this is not a good thing. Sometimes you want …

Tmux Bootstrap Configuration

February 17, 2018 – 3:22 pm
odsiuofisdufohuodsifugoisdgf

Just a list of commands to quickly configure tmux with some of the best (i.e. my favorite) plugins and options. Feel free to disagree – you may be right – but I don’t think so.

Show Logged In Users During a Time Window

February 17, 2018 – 2:59 pm
clock

Let’s say you want to see who was logged in on the server during last weekend. This includes users who, say, logged in on Thursday and haven’t logged out until Saturday afternoon.

Obfuscating Passwords in Shell Scripts

December 17, 2017 – 9:41 am
security_004

At the risk of repeating myself, I must say that this article is about obfuscating passwords – rendering obscure, unclear, or unintelligible – not hiding them. This can still be useful.

Extracting Email Addresses from TCP Streams

December 5, 2017 – 7:06 pm
shell

Here’s a quick example of using tshark to extract email addresses from TCP streams. Let’s say some application on your server is sending emails and you want to find out who is receiving those emails.

Whiptail and Dialog Snippets

November 27, 2017 – 3:41 am
oiuekjhdhdh

Whiptail is a newt-based utility allowing to build pseudo-graphical dialog boxes from shell scripts. Dialog uses ncurses and is similar to whiptail but has more options and, consequently, a bit harder to use. I find both useful …

Export WP Posts and Sync to Sharepoint

November 14, 2017 – 12:24 pm
DSC_6744 copy

Long story short: old wiki is overloaded and broken; new wiki is not a wiki but SharePoint – a glorified file server; people are forced to improvise and put documentation on a WP wiki; bosses …

Checking Multiple Variables in Bash

September 19, 2017 – 10:04 am
DSC_8295 copy_1280

Let’s say you have a dozen variables in your script and you need to check if they have values set. The usual approach can get a bit tedious.

Plotting Log Data

August 9, 2017 – 10:13 pm
logs_002

While I am on the subject of selecting time ranges from logs, a practical application presented itself. A lonely server in a far-away land with a habit of running out of memory could only be …

Croncal – the Cron Calendar

August 9, 2017 – 10:52 am
time clock watch

The croncal is a clever Perl script that reads entries in your crontab and outputs a schedule, showing the time when cron jobs will run.

Selecting Time Ranges from Logs

July 29, 2017 – 6:00 pm
shell_001

Consider a common situation: you would like to select lines from a log file that match a specific string, but only during a specific time frame. For example, my /var/log/messages contains entries from one of the …