12 modern Terminal/CLI tools that will change your terminal

Photo by Gabriel Heinzer on Unsplash

12 modern Terminal/CLI tools that will change your terminal

Mostly for UNIX, but some also run on Windows!

Fabrizio Mele's photo
Fabrizio Mele
·Nov 18, 2022·

6 min read

Featured on Hashnode

Subscribe to our newsletter and never miss any upcoming articles

Play this article

I switched off my last non-unix computer almost fifteen years ago. Since then I jumped from linux distro to linux distro, until my computer became the medium through which I was working and studying, and I could no longer afford to spend entire nights to trying to pacman -Syu or to fix yet another random error caused by god-only-knows-what. So I entered the magic world of Macs.

Surely the best thing about Macs is that they are UNIX. Yes macOS tends to be user friendly, and to hide almost all of the complexity behind glossy settings panel, but to a power user that knows how to use a terminal (or how to google) the customisation possibilities are surprisingly wide.

All of this to say that macOS is my daily driver, and as a developer I spend much of my day inside a terminal. In the last few years I created what I consider the most ergonomic terminal experience I ever had, much thanks to modern tools and commands which replace or encapsulate good 'ole programs, like cat , curl or find. My coworkers, after months of me bugging them about this stuff, found this a perfect subject on which to write a curated list! So, here they come.

Modern replacements

This tools are meant to replace existing common commands, sometimes as a drop in that requires just an alias in your dotfile.

lsd

lsd is a replacement for ls which introduces fancy colors and icons, while also being very configurable. It can be installed through almost any package manager, including Homebrew.

To set it as the "new" ls command just drop alias ls="lsd" in your terminal dotfile.

lsd in action

bat

bat is another really pretty tool , which is a drop-in for cat (a cat clone with wings). Bat supports syntax coloring, line numbers and git status, and can be configured via environment variables.

I've set alias cat="bat -P" in my config.fish and this is the result:

To remove line numbers just set alias ccat="bat -Pp" or something similar. Bat is available in all package managers.

bat in action

zoxide and fzf

One of the most tedious things to do while working in a terminal is getting around directories and jumping back and forth between them. Zoxide comes to our rescue, and paired with fzf, the command-line fuzzy finder, it could well remove almost entirely cd from your command history.

I recommend you go and take a look at all the usages and installation steps on Github.

z could easily replace the cd command, by being smarter and almost magical in its way to determine to which directory you want to navigate to (but you will need fzf for this).

1_yqpGtejyImZfAAmOaZ-3MA@2x.png

mcfly

mcfly is a nice little utility that replaces the ctrl+r behaviour of your shell with a search engine powered by a small neural network. I don't often use the ctrl+r , but when I do mcfly saves much much time and effort. Installation and configuration instructions can be found at the Github repo, I will just drop here a screenshot of its workings.

1_ImVXgC7v8PQ5-hNeTkJC1g@2x.png

The Silver Searcher

The Silver Searcher, aka ag , is a powerful (and fast!) code searching tool that saves me much time for example when I need to edit something inside some file in the current directory. It respects by default your ignore files, and has some handy options to filter the files. Install it with the package the_silver_searcher and try it out.

1_4Dsf8Zld75ERvjXFoi0aWg@2x.png

All the .ts files that contain "ArticleCardComponent", executed in 30ms. Needless to say this is much much faster than any find and grep combo.

ripgrep is a very similar tool, but I like ag more.

curlie

Curlie is a really nice drop-in replacement for curl. Curl is all powerful and almighty, but curlie takes it a step further mantaining parameter compatibility with the former. It supports syntax highlighting for headers and content, and prettifies json output when running interactively. alias curl=curlie is really a no brainer.

1_LqmpdhOR4GQicGffEeccwA.png

jq

jq is an essential tool to slice, filter, map and transform json data in command pipes. To get a sense on what it can do take a look here. It is a life saver while working on apis via curl.

fx

fx is less but for json, and smart. It is super useful to explore long json files or outputs, and requires zero learning time to get proficient with it. It accepts files as arguments or piped input, like less, and has mouse support.

fx

TUI tools

These are tools which use a terminal user interface to make things faster and I definitely use them very often.

lazygit

If I ever hosted "CLI Program of The Year" award then lazygit would win. I'm not a git cli expert, I've always used GUIs because I'm lazy and I like having a graphical representation of the status of my repos. I started with SourceTree years ago, then moved to GitKraken when SourceTree started to require a full minute to commit a handful of files, then moved to Tower when I felt the need for a native app.

If you're a mere mortal like me and you're tired of hearing how powerful git is when in your daily life it's a powerful pain in your ass, lazygit might be for you. (lazygit author jesseduffield)

Then I gave a try at lazygit, and now Tower is only for complicated squashes, rebases and advanced stuff. Lazygit is a wonderful TUI git client, made for speed and convenience: to stage all file just press a, to commit them press c, type your message, and then hit enter. To push P , to pull p, space to checkout a branch. If you ever feel lost x brings up the menu, with all available commands shown together with their shortcut. To give you an idea of the convenience and the ease of use, I tried multiple times to use vim or emacs as an everyday "light" editor, but were never able to get really used to all commands, shortcuts and whatnot. With lazygit everything felt almost as second nature for me. It's strongly suggested to at least give it a try.

1_ELxEZ3P3xnJuWDC-bNnq5w.gif

nnn

n³ (recursive acronym of Nnn's Not Noice!) is a nice and fast TUI file manager. It has a ton of features and the author has a strong opinion on how it should be used. It so rich of features that I felt fairly overwhelmed, but this didn't stop me from using its most easy and straightforward features, like simple navigation and quick editing. Give it a try, it's way faster and handy than the usual ls + cd flow.

1_mOcnErVNXP--tibH4V7KkQ.gif

broot

broot covers similar use cases to nnn , but it is different, and may better appease your personal taste, and is more a "tree replacement" Like n³ it support searching, paning, and file previews. For instance, it has a much better support for the "cd on exit" action.

1_IjdnfgKgP3rf3wHDetieUw.png

micro

Micro is a simple and intuitive text editor, that relies on common conventions (eg. ctrl+s to save, ctrl+q to quit) and useful comforts (scroll and select with the mouse). It supports theming and syntax highlighting, and has some nice plugins, although the ecosystem is quite small. It is perfect to do edits on the fly, it is the first thing I install on any new system (it ships in a single static binary).

1_1tIykHk_AbRh_trLGLWYAw.png

 
Share this