Every *nix engineer has a set of tools in their box. They make our lives and occupation easier, more efficient, and hopefully more enjoyable. We all use the big ones: Vim/Emacs, tcpdump, top, netstat, dig, telnet, SSH, etc., but there are a few others that are newer or don’t receive the love that the staples do. A lot of the commands that wind up in repertoire have to do with our mentor(s) and what they used, but we all discover new tools to facilitate or simplify a task. Here’s my list:
I originally came across htop in an issue of the Linux Journal a few years ago. I fell in love with this little tool almost immediately. It takes the venerable, but dated top command and jazzes it up. Htop makes use of the ncurses library, which provides a terminal-based user interface that is far superior to that of the classic top. Htop provides the ability to sort by metric, kill processes, switch to “tree” views, customize available meters and their order, and change the color scheme to name a few. Htop is a welcome departure from the top command.
My first introduction to Dag Wieers was his immense repository of custom-built Red Hat packages. I was supporting Red Hat Enterprise Linux at a university at the time. If we needed anything other than what Red Hat supported, there were only a few options: built the package myself, yum (which ironically enough was installed using packages built by Dag), or get the .rpm from Dag. At the end of the day, Dag’s packages were the best of the available options for us.
A few years passed and one of my coworkers introduced me to dstat. Dstat combines the functionalities of vmstat, iostat, and ifstat. It provides the ability to compare any system resource to another. If you would like to see how network traffic is affecting interrupts or disk I/O, they can be displayed next to each other, color-coded to reflect their intensity, and updated at a given time interval. Custom resource statistics can be output to a text file for later review or archiving if need be. While it would seem that htop and dstat would overlap, I use them for different purposes and both have their own place in my toolbox.
I’m sure you’re asking, “Stat? Why stat?” Yes, stat is about as ubiquitous as an command in the *nix world, but it was one of those useful commands that I never started using until much later in my career. I was unaware of stat until someone pointed out to me that I was wasting time by parsing directory listings in my scripts and there was a better way to obtain this information. I now use stat all the time for querying information about files or filesystems, sometimes directly in place of ls.
Bc is my go-to command line calculator. Once again, bc is as old as I am, but I still love it nonetheless. It can do everything the usual GUI-based scientific calculators can do and more. It has a syntax very similar to that of C and can perform basic arbitrary precision calculations out the door with the ability to load additional math libraries as needed. If you’re not already a bc user, give it a shot, but remember that length and scale are not the same.
Last, but not least, is a shameless plug for my beloved Ruby: irb, the Interactive Ruby Shell. I’ll say this again, I love Ruby. I love it’s simplicity, syntax, and extensibility. Irb provides a valuable resource for experimenting, developing, and testing code. Those of us that are familiar with Ruby and use it regularly can also do complex systems administration tasks on the fly without having to use other Unix shells. If you’re evaluating or already using Ruby, but haven’t tried irb, I highly recommend it.