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.
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
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.
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 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!
Top comments (12)
Nice! Thanks for sharing!
Also...
fun fact
it is git spelt backwardsHey 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 🤦🏽♂️.
For those using
nvm
and homebrew on OSX, be aware that installingfx
(a slick utility!) via homebrew will also install node as a homebrew dependency, whichnvm
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 checkingnvm
and realizing that it had switched to "system" node. As an alternative,fx
may be installed withnpm
itself:npm install -g fx
.Great article, love your posts!
Awesome post Darren especially the
http-prompt
tool usable to test HTTP APIsAdding some more CLI tools I've found useful over the years.
Updating multiple git repos cleanly via a single command - Gitup (tested on 15+ repos on a daily basis)
Checking which of your multiple repos need a pull, push, stash or upstreams - Multi-Git-Status
Random collection of even more CLI tools, link1 && link2 - (most of them are something even I wish to explore)
Thanks for sharing
Thanks for sharing! This is a really nice post
Thanks for sharing awesome
Is that... is that the Jurassic Park font?
What a nice article. Thanks for sharing!
Thanks for sharing!