Featured »

March 2, 2022 – 2:00 pm

Books have been written on the subject of awk and sed. Here’s a small sample of commands I put together over the years that are useful for everyday system administration tasks. Most of these tasks …

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

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 …

Install and Configure Etckeeper

June 23, 2017 – 8:05 am
shell_0006

Etckeeper is a handy tool that uses git to keep track of changes to anything in /etc (or any other folder you choose). It’s very simple to use and can help you quickly identify and undo stupid …

Using IPTables to Allow Access to Private Networks

June 22, 2017 – 9:46 am
network_cable_01

Below is a quick example of how to use iptables to allow port access for all types of private networks. In this case we’re allowing access to ports 10000 and 20000, commonly used by webmin and usermin.

Parallel Rsync

June 10, 2017 – 3:55 pm
shell_003

This is an update of the script I originally wrote five years ago and used to migrate many terabytes of production data between two NAS systems. What’s new: more efficient subfolder crawling, more effective way …

Pushing SSH Keys

March 21, 2017 – 10:54 am
security_006

This is just a quick note for me on pushing SSH keys using sshpass and xargs. The ~/hosts.txt file contains a list of remote hosts, one per line. And the ~/.passwd.txt contains your password. Make sure to chmod 400 …

Sample Salt Proxy Configuration for vCenter/ESX

March 20, 2017 – 4:15 pm
Spoon_Salt_Sugar_Black_Pour_1920x1200

The Salt proxy agent is a relatively new feature of Salt allowing to control networked devices where salt-minion cannot be installed directly. The official Salt documentation on the subject is outdated and full of syntax errors. It’s actually …

Configure and Run esxcli on Red Hat

March 20, 2017 – 3:58 pm
redhat_rhel_linux_0001

The esxcli utility is used to interface with the vSphere and ESX hosts. It is a useful tool for getting to some basic VMWare functionality from Unix shell. It is also a pre-requisite for some of …

Wget Examples

March 1, 2017 – 9:25 pm
dump truck

This is a follow-up to my previous wget notes (1, 2, 3, 4). From time to time I find myself googling wget syntax even though I think I’ve used every option of this excellent utility over the …

Install Webmin on CentOS and Redhat

February 27, 2017 – 2:10 pm
webmin_layout

Just a quick short-hand to installing Webmin on CentOS/RHEL. The latest Webmin version comes with a cool new interface theme. You should check it out.

Recover Crontabs from Log

February 27, 2017 – 12:15 am
clock tower

Some time ago I was using PDSH to update root crontab on a bunch of servers and ran into what looked like a PDSH-specific bug. The same command that worked just fine when executed locally or …

Monitoring DNS Queries

January 27, 2017 – 7:20 am
shell_0005

Recently I’ve been decommissioning old DNS servers and those things are notoriously hard to get rid of. The problem was that the IP addresses could not be preserved. I needed to track down every incoming …

DHCP Server Log Analysis

January 24, 2017 – 5:51 pm
servers_003

A quick script to go through your DHCP server log and get a summary of MAC addresses and associated DHCP requests. The script will attempt to download the IEEE OUI list for identifying the manufacturers …

Google Search Tips

January 15, 2017 – 10:17 pm
oskjdhhd

Google has some advanced search features that few people use, which is a shame. Here are some of them, by Karl Hindle. I am sure there are a few more, but these are the more …

Real-Time Log Stats With Logtop

December 30, 2016 – 1:00 am
logs_001

Logtop is an awesome, albeit a little quirky, real-time log analysis tool developed by Julien Palard. You should use logtop when time is of the essence. When you cannot wait for your cron job to run …

Grepping for IPs

December 11, 2016 – 5:47 pm
shell_0007

This is a small collection of tools and examples for working with IP addresses and ranges in Bash. This post is not meant to be a complete reference, rather a practical how-to guide.

Removing Strings from Binary Log Files

November 14, 2016 – 12:52 pm
shell_0004

Below is a quick script that will replace specified strings in binary files with random values. A word of caution: the script will preserve the file’s original ctime by briefly changing system time. Obviously, this requires …

Gather MX Records for a List of Domains

October 26, 2016 – 3:45 pm
email_004

This is a simple one: get a list of MX records for the given domains and output into CSV file. Really, the only interesting part of this is the use of array to temporarily store …

Installing Alternative Java Versions on RHEL/CentOS

October 26, 2016 – 2:23 pm
java_002

Below is shorthand for installing alternative versions of Java on your RHEL/CentOS system. This may come in useful for the purposes of testing.

Loan Payment Calculator in Bash

October 13, 2016 – 5:53 pm
968780_94091618

Just a little bit of fun with Bash: a loan payment calculator. Nothing fancy here. Maybe I’ll add the amortization schedule to it later…

BIND DNS Query Frequency Analysis

September 6, 2016 – 1:30 pm
overloaded_0001

The little script (dns_qpm2) below will look through your BIND query logs and calculate average query-per-minute rate for the given clients.e Nothing fancy, but can be useful in identifying the heavy-hitters.