loading...
Cover image for 5 CLI Utilities to Boost Your Productivity

5 CLI Utilities to Boost Your Productivity

_darrenburns profile image Darren Burns ・3 min read

Power Up Your Command Line (4 Part Series)

1) 10 Tools To Power Up Your Command Line 2) 5 More Tools To Power Up Your Command Line (Part 2 Of Series) 3) Power Up Your Command Line, Part 3 4) 5 CLI Utilities to Boost Your Productivity

Here are 5 command line tools I've found recently which can speed up your workflow.

fx, a command-line JSON processing tool

fx (GitHub) is a CLI tool written in JavaScript which allows you to process JSON using your terminal.

fx

You can explore and modify JSON using small snippets of plain JavaScript, and use your cursor to dive into the structure. For all of the functionality offered by fx, check out the documentation.

Installing fx

  • brew install fx

http-prompt, for interacting with APIs

http-prompt (website) is useful for exploring and interacting with HTTP APIs. It comes with autocomplete and syntax highlighting.

http-prompt

http-prompt is written in Python, and builds on top of HTTPie, which was covered earlier in this series.

Installing http-prompt

  • pip install --user http-prompt

fselect, for querying files with an SQL-like syntax

fselect (GitHub) is an alternative way to search your filesystem. It lets you use a syntax similar to SQL to find what you're looking for. For example, to find the size and path of all .cfg and .tmp files in /home/user/:

fselect size, path from /home/user where name = '*.cfg' or name = '*.tmp'

fselect also supports aggregation functions, similar to those you find in SQL:

fselect "MIN(size), MAX(size), AVG(size), SUM(size), COUNT(*) from /home/user/Downloads"

The query above will find the smallest file size, the largest file size, the average file size, the total file size, and the number of files present in your Downloads folder.

fselect is written in Rust, and it can do much more than the examples above suggest. It has extensive documentation.

Installing fselect

  • brew install fselect

ranger, a command-line file manager

ranger (GitHub) is a command-line file manager written in Python that lets you browse and manipulate your file system using Vim like keybindings.

ranger

It offers a multi-column display, the ability to preview files, and lets you perform common file operations (such as creation, deletion, chmod, copying, etc.) from within the ranger interface.

You can extend ranger by installing some Python packages which allow it to preview images, HTML documents, and PDF files. The image below is an example posted on the gallery available on the Ranger website, showing the image previewing functionality in action.

ranger-screen

Ranger is a deep piece of software with countless features that don't fit within the scope of this post. More information can be found in the official user guide.

Installing ranger

  • brew install ranger

tokei, to view statistics on your code

tokei (GitHub) lets you view code statistics for your projects by breaking down the languages you've used. It's written in Rust, which helps make it very fast.

Here's some example output from running tokei in my Advent of Code folder:

-------------------------------------------------------------------------------
 Language            Files        Lines         Code     Comments       Blanks
-------------------------------------------------------------------------------
 Markdown                1          165          165            0            0
 Rust                   13         1071          854           51          166
 Plain Text             17         4032         4032            0            0
 TOML                    1           11           10            0            1
-------------------------------------------------------------------------------
 Total                  32         5279         5061           51          167
-------------------------------------------------------------------------------

Installing tokei

  • brew install tokei

Conclusion

Thanks for reading! 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!

Power Up Your Command Line (4 Part Series)

1) 10 Tools To Power Up Your Command Line 2) 5 More Tools To Power Up Your Command Line (Part 2 Of Series) 3) Power Up Your Command Line, Part 3 4) 5 CLI Utilities to Boost Your Productivity

Posted on by:

_darrenburns profile

Darren Burns

@_darrenburns

A software engineer living in Edinburgh, Scotland. I'm passionate about programming, learning new things (and sharing what I learn), digital art, and good sci-fi/fantasy books! πŸ’»πŸ“šπŸŽ¨βœ¨

Discussion

markdown guide
 

Nice! Thanks for sharing!

Also...

  • fzf🌸: command line fuzzy finder (that can be integrated to everything)
  • z 🐸: z - jump around; for lazy people like πŸ™‹πŸ½β€β™‚οΈ
  • tig 😺: Text-mode interface for git; also fun fact it is git spelt backwards
  • p7zip πŸ“‚: Maximum file compression
 

Hey Derek, thanks for your comment.

I covered all of these tools except p7zip in my previous posts in this series :)

 

Nice! Great 🧠 think alikeπŸ˜‰

Also... I just figured out that these πŸ‘‡πŸ½are links πŸ€¦πŸ½β€β™‚οΈ.
links

 

For those using nvm and homebrew on OSX, be aware that installing fx (a slick utility!) via homebrew will also install node as a homebrew dependency, which nvm will then treat as the "system" version of node. I clubbed my head against the wall for some time trying to figure out why my native npm packages wouldn't compile correctly (node version mismatch) before checking nvm and realizing that it had switched to "system" node. As an alternative, fx may be installed with npm itself: npm install -g fx.

Great article, love your posts!

 

Awesome post Darren especially the http-prompt tool usable to test HTTP APIs

Adding some more CLI tools I've found useful over the years.

  1. Updating multiple git repos cleanly via a single command - Gitup (tested on 15+ repos on a daily basis)

  2. Checking which of your multiple repos need a pull, push, stash or upstreams - Multi-Git-Status

  3. Random collection of even more CLI tools, link1 && link2 - (most of them are something even I wish to explore)

 
 

Is that... is that the Jurassic Park font?

 

Thanks - I've recently inherited some linux based services at work and while I can get around, I'm far from proficient - these look really helpful.

 

What a nice article. Thanks for sharing!

 
 

Thanks for sharing awesome

 

Thanks for sharing! This is a really nice post