DEV Community

Cover image for Power Up Your Command Line, Part 3
Darren Burns
Darren Burns

Posted on • Updated on

Power Up Your Command Line, Part 3

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

This post was originally published on my blog.

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 of 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.

Top comments (4)

Collapse
 
jeklah profile image
Jeklah

Fucking=sudo is one of my favourite aliases

Collapse
 
toby profile image
toby

I particularly like to use sudo !!
(in case you don't know, the !! means the last command. So it works, but also feels good to mash the bang key a few times :) )

Collapse
 
toby profile image
toby

FYI tig can take an rc file (.tigrc) that allows you to customise it. A lot. The commit history ccan get a lot pretty with no overhead (that I've noticed).
Just Google tigrc, or look at github.com/jonas/tig/blob/master/t....

Collapse
 
maccevedor profile image
Mauricio Acevedo Rueda

thanks