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 using the arrow keys, and select a result with the enter key. When you press enter, the command outputs the result to your terminal.
Installing peco
- On macOS with Homebrew:
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:
- An offset column, which tells you how many bytes into the file you are.
- A hex column (which itself has a divider down the middle - not visible in the example gifs), which contains the hexadecimal representation of the file.
- A representation column (also split in two, and not shown in the example gifs), which contains a textual representation of the file.
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 hexyl
into bat
or less
to give you the ability to paginate through it! You’ll need to use the --raw-control-chars
/-r
flag for the output to be coloured correctly if you use less
:
hexyl
is written in Rust, and is developed by David Peter who also wrote bat
, fd
, and hyperfine
, all of which I mentioned in part one of this series.
Installing hexyl
Installing hexyl
requires a few steps on macOS:
- Download the binary from GitHub:
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
- Extract the tarball:
tar -xf hexyl.tar.gz
- Add it to your
PATH
:mv hexyl-v0.3.0-x86_64-apple-darwin/hexyl /usr/local/bin
- Make executable:
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:
- For 25 minutes, you work and allow for no distractions.
- For 5 minutes, you relax and do whatever you want (as long as it isn’t work 😁).
- Repeat the steps above 4 times (you can adjust this number to suit yourself), then rest for 15 minutes
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 its effectiveness!
pomo
(GitHub) is a simple, configurable CLI tool to help you manage your time through the pomodoro technique.
Installing pomo
There are a few steps to follow to install this one (on macOS):
- Download the binary from GitHub:
curl -L -o pomo https://github.com/kevinschoon/pomo/releases/download/0.6.0/pomo-0.6.0-darwin-amd64
- Grant permissions:
chmod +x pomo
- Put it on your
PATH
so you can use it from anywhere:mv pomo /usr/local/bin
- Initialise the database:
pomo init
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
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 the interactive interface to browse through your filesystem using the arrow keys, or the navigation keys from vim
if that’s your thing.
Installing ncdu
- On macOS with Homebrew:
brew install ncdu
HTTPie, a modern replacement for curl
HTTPie (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).
Installing HTTPie
- On macOS with Homebrew:
brew install httpie
Conclusion
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 in the comments. If you’re interested in more content like this, follow me on Twitter and on DEV.
Originally posted on my blog.
Top comments (8)
Thanks again for another nice list.
peco
seems cool!I've tried to use
httpie
in the past but I'm faster withcurl
because I've memorized most of the stuff I use commonly. The rest I google each time I need :DNice list: I have been using
httpie
and it's awesome. I pickedpomo
from this list.Check the following list
tldr
(Simplified and community-driven man pages): github.com/tldr-pages/tldrpv
(monitor the progress of data through a pipeline): ivarch.com/programs/pv.shtmljq
(sed for JSON data): stedolan.github.io/jqThanks 🙂 I was going to include tldr in the next post, and possibly jq too.
Never heard of pv, but I'll check it out
Great follow up! Installed HTTPie and ncdu.
You can actually use fzf from the first list like you use peco in that example! It accepts anything from stdin, and passes the selection to stdout. One of my favorite command line tools!
HTTPie, nice!
Nice list.
I've been using hecate lately, it's a nice hex viewer and I love the way it displays the content instead of the usual hex/ascii columns.
That looks fantastic!
Thanks