I accidentally came across the moreutils package a few years back and the day I did my life changed forever. This package contains some killer utilities and fill some nice gaps in the *NIX tool chain. Here is a list of the binaries in this package (descriptions taken from the man page of each utility):
chronic - runs a command quietly unless it fails combine - combine sets of lines from two files using boolean operations errno - look up errno names and descriptions ifdata - get network interface info without parsing ifconfig output ifne - Run command if the standard input is not empty isutf8 - check whether files are valid UTF-8 lckdo - run a program with a lock held mispipe - pipe two commands, returning the exit status of the first pee - tee standard input to pipes sponge - soak up standard input and write to a file ts - timestamp input vidir - edit directory vipe - edit pipe zrun - automatically uncompress arguments to command
I’m especially fond of errno, chronic and pee. But my favorite utilities have to be ifne and ts. Ifne is useful if you need to run a command if output is present. One such use is e-mailing someone if a monitoring program spits out an error:
hardware_monitor | mail -s "Problem detected with the hardare on $(/bin/hostname)" admins
The ts utility is just as useful. Say you have a program that randomly spits out lines of gik and you want to know when the lines of gik occurred. To get a timestamp you can pipe the programs output to ts:
gik_generator | ts
Nov 02 09:55:11 The world needs more cow bell! Nov 02 09:55:12 The world needs more cow bell! Nov 02 09:55:13 The world needs more cow bell!
I love coming across tools that make troubleshooting and shell scripting more enjoyable. Now we just need more cow bell!