A collection of useful command line tools

Published: November 14, 2020   |   Updated: April 21, 2021   |   Read time:

Tagged:

Image Attribution:

Before the GUI, the command line was all you could use for interacting with a computer. Despite the explosion of native applications, web apps, and all sorts of GUIs, using the command line is just better for many tasks.

Here are some of my favourites that I use on a regular basis.

Coreutils-ish

bat

A replacement for cat, with bells and whistles galore. Syntax highlighting, git diffs, less-like scrolling, and still works with pipes.

bottom

A replacement for top. Editable, graphs, and temperature sensors. It shows you a lot of information in a nicely designed terminal user interface.

diskus

A replacement for du. Fast with a human-friendly output unless it gets piped to another command. There’s some clever engineering behind this tool, and is great for quickly triaging what folders you need to delete when clearing up space on your machine.

fd

A replacement for find. Fast, colour-coded, and more sane defaults than find. My most common uses include looking for the location of a PDF in my Zotero library with fd -e pdf and executing a command on each file that is found with fd -x.

gping

A replacement for ping. Show a graph of your ping times instead of just a list of numbers.

lsd

A replacement for ls. Big bold colours, sorting by extensions, and other goodies packed into the flags and options.

ripgrep

A replacement for grep. Colour-coded, recursive by default, and fast (are you sensing a theme?). See this blog post by ripgrep’s developer about it, as well as this post that compares features between ripgrep and many similar tools. It’s not POSIX compliant or necessarily ready for production code, but is great for manual use (and you save 2 whole characters instead of typing grep).

ripgrep_all

This tool actually uses ripgrep as a backend to extend support into non-plaintext files, like PDFs, Office documents, etc. This is great for quickly extracting DOIs from scientific papers.

sd

A replacement for sed. It’s fast and a little more user-friendly, since you don’t have to deal with all the regex syntax and quotes by default. You can still use the most powerful regular expressions and get all the power out of it thanks to Rust’s regex crate.

tealdeer

A replacement for man. It takes the hassle out of reading some of the manual pages, not just for coreutils, but for many others, too. It’s built to function just like tldr, but is re-implemented in Rust instead of Javascript to be fast.

zoxide

A replacement for cd. zoxide is meant for navigating your file system just like cd, but with some extra capabilities behind it. This includes a reachable-from-anywhere list of folders you have either bookmarked or frequently visit. You don’t even have to type in the entire name of the directory if you don’t want to as it has tab autocompletion and is regex-capable. I used to define a bunch of special aliases for certain directories to jump around easily, but I don’t have to do that anymore and pollute my environment’s namespace. And the cherry on top is that zoxide is executed with just the letter z. Your future carpal tunnel will thank you.

Package managers

For macOS, it’s homebrew. For Windows, it’s scoop. I have used Chocolatey in the past, but I didn’t find it as intuitive as Scoop. AppGet was another good package manager for Windows, although it’s no longer being maintained due to Microsoft’s recent announcement of WinGet. There’s some history between the two projects, if you’re interested in reading how WinGet was born out of AppGet.

Working with documents

7zip

Easily interact with compressed files of many different formats. This tool has been around for a long time and is very robust. Its age does show a bit in its help dialogue and argument parsing format, but it’s still extremely functional.

pandoc

This is a stable, robust tool that has been around for a long time and can convert just about any type of document in one format to another. Check out this figure to see if this might be useful for you.

pdftools

Splicing and handling pages in PDFs is always a bit frustrating, and uploading your PDF to some website that can do what you want just isn’t realistic for sensitive documents. pdftools is a CLI for a Python package that lets you split, merge, zip, rotate pages, and more. Everything stays local, everything stays private. Disclosure: I have contributed to this tool.

xsv

If you work with a lot of tabular data, xsv can make your experience with them a lot better. Having equally-spaced columns, even from comma-separated files, makes viewing them much easier, and you can perform joins, sorts, and other common operations easily.

visidata

Another tool for interacting with tabular data. It’s got some fancy effects like visualizing data as a histogram and interactive row/column navigation. Sadly, it’s the only tool mentioned here (aside from Homebrew) that doesn’t run on Windows. You can run it indirectly through the Windows Subsystem for Linux, but it isn’t fully native.

Miscellaneous

fend

An arbitrary-precision calculator written as a REPL that also handles units and conversions nicely. It is very similar to insect, but written in Rust instead of JavaScript. It’s a great tool for quick calculations that also includes a history. I prefer to use this over the built-in calculator for a lot of things.

gitui

I find GUI tools for handling git repos like SourceTree and GitKraken a little over the top. I mostly use the command line or my IDE’s built-in VCS tool. But occasionally it is nice to see what you’re staging or committing, and gitui makes this clean and easy. Intuitive and concise folder navigation makes this pleasant to work with, too.

hyperfine

This tool makes benchmarking various commands simple and fast. I’ve used it to benchmark some bioinformatics software I’ve written. It has a great interface, you can specify the number of repetitions to get some statistical confidence, compare multiple commands simultaneously, and even export your results to a nicely formatted file.

pastel

I spend a lot of time designing figures and plots for my scientific work. Having a consistent and clear colour scheme is an essential part of communicating through figures, and this tool makes it extremely easy to pick and show multiple colours, calculate gradients, or pick a colour at random. This tool is also great for designers who just need a quick one-off helper instead of opening an entirely separate application or palette to convert between HEX and HSL or RGB.

petname

Whenever I start a new project, I like to give it a name. My projects will evolve over time and may not always resemble the initial name I gave it. So I give it a nonsensical name like wiley-gorilla or especially-excited-escargot. petname is the perfect tool to get a new project name quickly and with some style.

starship

For a person who works with computers and data for a living, customizing your terminal shell is like a carpenter laying out their workshop. Everybody has their preferences and you want to lay out your space in a way that will make you more productive. Starship is one of many methods for accomplishing this, but it has some great features that I have yet to find in other tools. The multi-OS, multi-shell support makes it usable on any computer you have, its documentation is clear and thorough, and it supports a variety features for different programming languages and toolchains. It is a tool built by developers for developers with ease-of-use and design highly prioritized. Few software tools are able to accomplish this well, and this is one of them.

Worthy mentions

These tools aren’t necessarily “useful”, but they definitely are ones that I quite enjoy for some reason or another.

grex

If regular expression confuse you, you can use grex to create them for you by giving it a few examples. It will always give you a regex that will match what you’ve given it, but it may not always be what you want. But it’s a super fast and easy way to start building a regex if you struggle with it. An online tool that can also help with this is Regex Tester, which I will often use when trying to filter out odd chromosome names for a particular species. Here’s an example for humans.

insect

insect is a cool terminal-based calculator. It looks and feels like any other REPL, but it naturally recognizes physical and mathematical constants. It also handles units, allowing you to convert between different units of the same type. It has colour-coded text to show when units or commands are recognized, and shows the output in a very human readable way. My only gripe with it is that it relies on npm, but it was initially designed as a web app, which you can find here.

neofetch

This tool makes it easy to show properties of your system, like how much RAM is available and what version of an OS you’re using. It’s also extremely useful if you’re customizing the colour scheme for your terminal emulator and you want to see how certain colours look together.

onefetch

onefetch is basically a copycat of neofetch, except that it gives you information about your git repository. It’ll show you information like what languages are used, how many branches it has, what your HEAD currently is.

silicon

This tool makes it easy to create beautiful images of code that are easy to share with others. I used it when describing a tool I built for keeping track of my bill statements. It includes syntax highlighting for a bunch of languages and can copy directly from your clipboard or parse files entirely.

thefuck

Mildly unprofessional but always relatable. Fix the typos in your previous commands by typing out what’s in your head.

viu

Viewing images from your terminal kind of defeats the purpose, doesn’t it? But that’s exactly what I like about viu. It lets you quickly view an image file without having to switch out of your terminal. Sure, it’s often going to give you a low-res version of the actual file, but come on, you’re viewing it in a terminal. What did you expect?

Conclusion

It feels like there is an explosion of these types of tools. My guess is that the re-invigorated development of high performance programming languages like Rust, Zig, and Go has brought back enthusiasm for making new tools that solve useful everyday problems. I think it’s worth noting that many of these are written in Rust, and that many of them are made by David Peter (@sharkdp) or Andrew Gallant (@BurntSushi). These two have some other great projects on their GitHub profiles that I’d recommend checking out. All of the other developers of the tools in this post are also worth checking out, too.

There is an entire world of excellent and fascinating command line tools for you to explore. These are a few that I have found that have helped me in my work or make my life more enjoyable. Happy coding.