Articles in Commands & Shells
Plotting Log Data
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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.

Latest Comments