Articles in Commands & Shells
Using YUM to Sync Packages with Master Server
I just built a new CentOS box and needed to make sure it had all the same packages installed as one of my other servers. If you need to set up your own web server …
Nohup Without Nohup.out
This is a common question: how can I run nohup without creating the annoying nohup.out ? And the common answer is: you can’t. But this is not exactly true.
Improving Your Scripts with ShellCheck
Unlike most other popular scripting languages, Bash has few style-checking utilities. The best one, I think, is ShellCheck – a very cool and useful utility that can greatly enhance robustness of your scripts. Like that time …
Better ‘date’ Functionality in Solaris
The Solaris date command does not have many of the useful features of its GNU equivalent. A workaround is to use Tcl. This requires tclsh to be installed (which tclsh). You can implement this workaround as …
Create NFS share from QNAP CLI
In this example we create the “test” NFS share on a QNAP NAS from CLI and export it to client_ip_01 and client_ip_02. Things to keep in mind: this only creates an NFS share – not …
Speed Up Shell Loops Using Arrays
Just a quick note on addressing a common issue of running redundant commands when using shell loops. Let’s say you needed to get a count of network connections to an Oracle database server for each connection …
Useful Bash One-Liners
Here’s a loosely-organized pile ‘o shell quickies I kept googling now and then and finally decided to write ’em down.
Finding Prime Numbers
I have no intention of competing with GIMPS. To me this is a fun scripting exercise that may produce useful results beyond this initial application. Our goal is to take a bunch of integers and …
Monitoring Application Network Connections
A Java application on one of my servers has been causing problems by opening up too many network connections and now closing them quickly enough. I needed to be notified when the number of connections …
Run Cron Jobs at Arbitrary Intervals
Current versions of cron support sophisticated syntax making creating weird schedules a breeze. With older versions of cron you normally had to schedule multiple jobs to fill every time slot in a complex schedule. The …
Diff on Output of Remote Commands
Let’s say you run the same command on two remote servers and you want to compare the output. Here’s a quick example:
Parallel MySQL Queries
Unlike Oracle, MySQL has no support for parallel SQL queries. A bummer for sure, in light of all the awesome multi-coreness we enjoy these days. There’ve been some attempts (1, 2) to get around this …
Show NIC Bandwidth Utilization
Just a quick script that will measure bandwidth utilization in KB/s for all NICs on your server over the specified period of time. You can call the script with an optional time wait parameter in seconds.
When Was that Server Built?
Just a quick note on how to (sort of) figure out when a server first came online. This can be useful to various folks in your bean-counting department working on maintenance contract renewals and whatnot. …
Testing Email Server Response
A little while ago I ran into a situation when connections to the relay email server would occasionally time out. The issue seemed sporadic resulting in a controversy regarding its source. The perimeter email server …
Detecting Sun ILOM with NMap
This is an oddball tech note: how to detect Sun ILOM interfaces on the network using nmap. I needed to connect to one of the Sun boxes that dropped off the network, but couldn’t remember …
Installing Perl Modules with YUM
Just a quick note on how to install Perl modules with YUM. Due to differences in the naming conventions, YUM package name for a Perl module may differ from the the module’s native name in …
Brief Guide to PDSh
PDSh (Parallel Distributed Shell) is a high-performance parallel remote shell utility allowing you to execute commands on multiple remote hosts simultaneously. The utility was originally developed by LLNL and is currently available under GNU CPLv2. …
Dealing with Runaway Processes
There is no official definition of a “runaway process”. Generally, it is a process that ignores its scheduled priority. It can also be a process that enters an infinite loop. Or it can be a process …
Enabling dmesg Timestamps in RHEL
By default, CentOS/RHEL dmesg timestamps are disabled. Here are the instructions to enable timestamps and a quick script to display time in a human-readable format.
Simple Statistical Functions in Shell
Here’s a small collection of basic statistical functions you can use in your shell scripts. This may come in handy when analyzing disk space, system performance, etc.
Detecting Synology NAS with nmap
Just a quick note for myself on how to find Synology NAS servers on the network without having to use the bulky Windows utility that ships with these systems.

Latest Comments