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

Using YUM to Sync Packages with Master Server

August 21, 2016 – 10:40 pm
hard drive disk

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

July 13, 2016 – 12:55 am
shell

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

July 7, 2016 – 8:42 pm
968780_94091618

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

June 28, 2016 – 8:53 am
HP-Greets-IBM-2

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

June 13, 2016 – 2:21 pm
qnap_nas_001

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

June 7, 2016 – 9:02 am
shell_003

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

May 2, 2016 – 8:43 am
shell

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

April 22, 2016 – 2:09 pm
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

February 11, 2016 – 3:12 pm
network switch

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

January 27, 2016 – 10:24 am
time clock watch

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

January 25, 2016 – 1:47 pm
shell

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

January 19, 2016 – 12:38 am
mysql_0001

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

January 15, 2016 – 12:43 am
network switch

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?

November 11, 2015 – 11:49 am
shell

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

November 7, 2015 – 5:37 pm
colorful shells

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

October 13, 2015 – 10:57 am
sun_solaris_0002

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

August 17, 2015 – 5:30 pm
centos_linux_0003

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

August 17, 2015 – 12:53 pm
shell

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

July 14, 2015 – 10:46 pm
shell_003

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

June 12, 2015 – 5:04 pm
1378002_16584036

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

June 3, 2015 – 12:01 pm
colorful shells

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

May 29, 2015 – 3:07 pm
computer_security_it_privacy_0002

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.