i Useful CLI Tools · Dark Matter Industries

Useful CLI Tools

These are some of the most useful command line tools for me for generic work at the terminal. I have not included specialist cloud tools like rclone, or even gh. I have also left out the common tools that everyone uses: the built-ins, sed, awk, grep, ssh, ssh-add, etc. although I use them very often.

First, my package manager on macOS (Darwin):

Homebrew

https://brew.sh

Over the years this has been my package manager of choice on macOS. It installs both CLI programs and app packages for the GUI.

On Linux, well, you know.

aerc

https://aerc-mail.org

An experimental IMAP client based on vim bindings. I find this more lightweight and much, much easier to set up than neomutt. But it is much younger than the neomutt that I used to use and thus far has far fewer features, but if you just want a quick basic email client, this is fast. It also is programmed to work with github messages.

bat

https://github.com/sharkdp/bat

As it says in the website linked above: bat is a cat clone with syntax highlighting and Git integration. It also pipes automatically into a pager like less if the output is more than a screen full. It’s much, much faster and better than the old hack of using Pygmentize on less. In addition, it also shows line numbers so you can vim directly to the line that you want.

btop

https://github.com/aristocratos/btop

An even newer top ps monitor. but it’s beautifully implemented. It really shows what you can do with a full colour terminal.

exa

https://the.exa.website/introduction

Exa is an evolution of the venerable ls. With it, files and directories are coloured according to file type. You get a tree view as well and even the ability to display the git status of each file.

htop

https://htop.dev

top is a fine tool that is found in every unix/linux system. It does the job for a quick scan of running processes, but is not very interactive. In addition, I find that those large numbers in the VM and Networks section just do not compute. What does 15058803 swapins mean to you? htop has some graphical interface and many options to find and drill down to the processes that you may be looking for. I was happy with htop until I found btop (see above).

iperf3

https://github.com/esnet/iperf

This is an interesting tool that is used in the enterprise to measure bandwidth of a network you have built. This is especially useful if you are building a fast wired network and want to understand where the bottlenecks are. The software is both a “server” and a “client”. Run it as a server on one machine and a client on another - it will flood the network with packets and measure the through put.

jq

https://stedolan.github.io/jq/

With this tool you have the ability to extract values in JSON objects and arrays, and manipulate the values, from the command line without piping to another scripting language like Python. It is also far more easier than trying to use sed and awk to achieve the same thing (believe me, I have tried). The syntax of jq can be very confusing. In this blog I have written a short entry on how to extract values from JSON objects and arrays using jq.

ncdu

https://dev.yorhel.nl/ncdu

A du with an ncurses interface! This allows you to drill down interactively in folders and find space hogs (as in files that take disk space, not interstellar pigs).

speedtest-cli

https://www.speedtest.net/apps/cli

The cli-version of speedtest that you find on iOS and Android. Test your upload and download speeds from the CLI. There are many options that allow you to fine-tune the test and even output the results into a csv.

ripgrep

https://github.com/BurntSushi/ripgrep

This tool makes it super simple to search for text within files, and nicely displays the results with the search term highlighted. In addition, you don’t need to specify the input files - the default assumption is that you want to grep through all files in the current directory, although you can use its --glob flag to filter the input files. This is a useful tool but does not follow the POSIX standard, so should not replace grep.

rsync

https://rsync.samba.org

This is one of my most used tools. If you want to copy a few files, cp might do. But rsync takes care of things like extended attributes and has options to preserve mtime , owner and group ID etc. It’s fast and reliable. I use it to back files up into external media.

tmux

https://github.com/tmux/tmux/wiki

This is a tool I use all the time. tmux not only maintains persistent sessions on remote servers in case connections drop (or if you want to disconnect temporarily), but it’s also about window management. Use it to open multiple window panes and windows, each with its own terminal session (hence the name: terminal multiplexer). I use tmux all the time – it’s the first thing I launch when faced with a new terminal.

7-zip (7z)

https://7-zip.org

One of the most efficient compressors I have used. Sadly it should not be used to compress files directly for backups as 7z does not preserve group ID nor UID, however, you can use it to compress a tar file. Hidden in the application is an incredible CPU benchmark tool, which allows you to compare and select the best performing system for compressing large files. It is invoked with 7z b (b=benchmark). I find it a useful tool on a stand-alone basis when trying to compare various machines and troubleshoot (for example if I am in a warm environment and suspect CPU throttling). On homebrew there are several similarly named packages. The one you want is p7zip.