Power Up Your Command Line III

Published on January 7th 2019

This is part three of the Power Up Your Command Line series. In this article, I’ll showcase five utilities that will make common problems a little easier to solve using the command line.

tig, for interactively browsing your git repo

tig (GitHub) is an excellent way to browse your Git repository using an interactive interface, without leaving the command line.

tig

tig is simple and intuitive to use, and has different views for things like your stash, staging area (which it lets you quickly alter), logs, and so on.

Thanks for Renato Suero (@renatosuero) for introducing me to tig on DEV.

Installing tig

  • On macOS with (Homebrew): brew install tig

PathPicker (fpp), for quickly selecting files

PathPicker (GitHub) is a library by Facebook for quickly selecting files on the command line. The animated example below is taken from the PathPicker documentation.

fpp

From the PathPicker website:

PathPicker accepts a wide range of input — output from git commands, grep results, searches — pretty much anything. After parsing the input, PathPicker presents you with a nice UI to select which files you’re interested in. After that, you can open them in your favorite editor or execute arbitrary commands.

Thanks to Nikolay Dubina (@nikolayid) for suggesting this utility.

Installing PathPicker

  • On macOS with (Homebrew): brew install fpp

tldr, for practical examples for how to use CLI tools

tldr (GitHub) lets you quickly access practical examples (simplified, “tl;dr” versions of man pages) of how to use command line tools.

tldr

The examples are maintained by the community in the tldr GitHub repository.

Installing tldr

  • With npm (recommended): npm install -g tldr
  • On macOS with (Homebrew): brew install tldr

gron, for exploring JSON

gron (GitHub) transforms JSON text into discrete assignments, to make it easier to find what you need. I particularly like using it for interactively exploring APIs in combination with fzf (mentioned earlier in this series):

gron-with-fzf

You can also use gron to help you transform JSON objects (examples). This isn’t the main use-case of gron though, and you’d probably be better served using a purpose built tool like jq for such things.

Installing gron

  • On macOS with (Homebrew): brew install gron

thefuck, for quickly correcting command line typos

If you mistype a command, type fuck (GitHub) and you’ll be given a list of corrections to choose from.

thefuck

The name of the command is unfortunately slightly NSFW, so you may wish to alias it to something else.

Installing thefuck

  • On macOS with (Homebrew): brew install thefuck

Bonus: explainshell, for explaining shell commands

If you’re in the situation where you already have a complex shell command and want to understand what it does without browsing man or tldr pages, you can use explainshell:

explain_shell

Conclusion

Hopefully you found something on this page that interests you! If you’re interested in more content like this, follow me on Twitter and on DEV.


Darren Burns

Darren Burns

I'm a Software Engineer working at FanDuel in Edinburgh, Scotland.󠁢
Follow me on Twitter!