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 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.
brew install tig
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.
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.
brew install fpp
tldr, for practical examples for how to use CLI tools
The examples are maintained by the community in the
tldr GitHub repository.
npm install -g tldr
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):
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.
brew install gron
If you mistype a command, type
fuck (GitHub) and you’ll be given a list of corrections to choose from.
The name of the command is unfortunately slightly NSFW, so you may wish to alias it to something else.
brew install thefuck
If you’re in the situation where you already have a complex shell command and want to understand what it does without browsing
tldr pages, you can use explainshell: