This is part II of the series “Power Up Your Command Line”, which showcases excellent non-standard tools that will make using the command line easier and more enjoyable.
peco, interactively filter anything
Pipe the output of any command into
peco (GitHub), and you’ll be able to interactively filter it to find the information you need. Think of it like an interactive form of
grep, where the real-time updating of results as you type allows for a more exploratory search process.
You can move up and down through the search results, and select them with enter. When you press enter, the command outputs the result.
brew install peco
hexyl, a hex viewer
If you want to examine a binary file, you typically do so by looking at the hexadecimal representation of the file.
hexyl (GitHub) is a command line tool for doing just that.
The view is split into three columns:
Each byte in
hexyl is colour-coded depending on the type of byte it is (NULL, ASCII, non-ASCII, etc.) which really helps with readability.
Bonus tip: If viewing binary files or large text files, the output will often be too large for your screen, so you can pipe the output from
less to give you the ability to paginate through it! You’ll need to use the
-r flag for the output to be coloured correctly if you use
hexyl is written in Rust, and is developed by David Peter who also wrote
hyperfine, all of which I mentioned in part one of this series.
hexyl requires a few steps on macOS:
curl -L -o hexyl.tar.gz https://github.com/sharkdp/hexyl/releases/download/v0.3.0/hexyl-v0.3.0-x86_64-apple-darwin.tar.gz
tar -xf hexyl.tar.gz
mv hexyl-v0.3.0-x86_64-apple-darwin/hexyl /usr/local/bin
chmod +x /usr/local/bin/hexyl
pomo, a pomodoro timer
The pomodoro technique is a great way to boost your productivity. If you haven’t heard of it before, it works like this:
If you follow the plan above, the theory is that you’ll get considerably more done in considerably less time. It might not work for everyone, but I can personally vouch for it’s effectiveness!
pomo (GitHub) is a simple CLI tool to help you manage your time through the pomodoro technique.
There’s a few steps to follow to install this one (on macOS):
curl -L -o pomo https://github.com/kevinschoon/pomo/releases/download/0.6.0/pomo-0.6.0-darwin-amd64
chmod +x pomo
PATHso you can use it from anywhere:
mv pomo /usr/local/bin
ncdu, analyse and free disk space
If you’ve got a lot of projects on your computer and haven’t cleaned up your disk recently, you’ll almost certainly find a rogue folder that is hogging disk space (I’ve found some
node_modules folders in older projects to be particularly susceptible).
[ncdu](https://dev.yorhel.nl/ncdu) is my favourite tool for fixing this. In fact, in the process of creating the demonstration for
ncdu below, I freed up over 10GiB of disk space!
To use it, run
ncdu. It’ll scan all subdirectories from the directory you ran it in, so if you run it in your home directory, it might take some time.
You can use its ncurses interface to browse through your filesystem using the arrow keys, or the navigation keys from
vim, if that’s your thing.
brew install ncdu
http) is a simpler (meaning I don’t have to Google it every time, unlike with
curl), feature-rich and beautiful alternative to
curl, which will let you call APIs over HTTP from the command line. It’s the most popular utility I’ve reviewed so far, and has exceptional documentation.
The output from the
http command is what really sets it apart from cURL. JSON responses are pretty printed with syntax highlighting, making them far more readable. If you’d rather use a graphical UI for interacting with APIs, you might like Insomnia, Postman or Paw (Paw requires a license and is macOS only).
brew install httpie
Thanks for reading! There are a couple more tools I’d like to mention in the next post in the series, but if you have any suggestions let me know! If you’re interested in more content like this, follow me on Twitter.