DEV Community

Cover image for 5 More Tools To Power Up Your Command Line (Part 2 Of Series)
Darren Burns
Darren Burns

Posted on • Updated on

5 More Tools To Power Up Your Command Line (Part 2 Of Series)

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.

peco-processes

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.

hexyl

The view is split into three columns:

  1. An offset column, which tells you how many bytes into the file you are.
  2. 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.
  3. 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-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.

sharkdp image

Installing hexyl

Installing hexyl requires a few steps on macOS:

  1. 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
  2. Extract the tarball: tar -xf hexyl.tar.gz
  3. Add it to your PATH: mv hexyl-v0.3.0-x86_64-apple-darwin/hexyl /usr/local/bin
  4. 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:

  1. For 25 minutes, you work and allow for no distractions.
  2. For 5 minutes, you relax and do whatever you want (as long as it isn’t work 😁).
  3. 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

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):

  1. 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
  2. Grant permissions: chmod +x pomo
  3. Put it on your PATH so you can use it from anywhere: mv pomo /usr/local/bin
  4. 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!

ncdu

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.

httpie

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)

Collapse
 
rhymes profile image
rhymes

Thanks again for another nice list. peco seems cool!

I've tried to use httpie in the past but I'm faster with curl because I've memorized most of the stuff I use commonly. The rest I google each time I need :D

Collapse
 
dawitnida profile image
Dawit Nida • Edited

Nice list: I have been using httpie and it's awesome. I picked pomo from this list.
Check the following list

Collapse
 
_darrenburns profile image
Darren Burns

Thanks 🙂 I was going to include tldr in the next post, and possibly jq too.

Never heard of pv, but I'll check it out

Collapse
 
coreyja profile image
Corey Alexander

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!

Collapse
 
david_j_eddy profile image
David J Eddy

HTTPie, nice!

Collapse
 
igormp profile image
Igor Moura

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.

Collapse
 
_darrenburns profile image
Darren Burns

That looks fantastic!

Collapse
 
maccevedor profile image
Mauricio Acevedo Rueda

Thanks