James Quigley's Blog

My CLI has been getting a little Rusty

September 21, 2020

I also made a video version of this post, if you’d rather watch than read.

Over the past few years I’ve adopted a handful of various CLI tools that I lean on frequently. Some of them I discovered on my own, some from coworkers, some from discussion topics during NYC CoffeeOps, a weekly meetup that I help co-organize. However one thing that I’ve noticed is that all of these tools happen to be written in Rust! Take from that what you will, but regardless of what language they’re written in, these tools are pretty neat, and I’d highly recommend them!


Note: I blatantly stole this idea from someone in the meetup who said this would make a good blog post. Thank you for your wonderful idea.


The tools

starship

Starship is the prompt I use for my shell. I love that basically with zero configuration, I get a really nice looking shell that integrates with all the tools/languages I use regularly. Alongside oh-my-zsh and iTerm2, it makes for a great terminal aesthetic.

lsd

Lsd is an alternative to ls. I like it because it includes colors and icons to more easily distinguish between types of files and directories

insert requisite drug joke here

ripgrep

Ripgrep is an alternative to grep. It searches text, but does it lightning fast. I once was trying to search a ~200GB dump of hacked usernames/passwords to ensure that none of my accounts had been compromised, and other methods of searching would have taken literal days, but ripgrep did the search in less than a minute.

Some other pros of ripgrep that I enjoy:

  • Obeys .gitignore files
  • Easily searches gzip archives

I use the latter feature occasionally to search logs automatically put into S3 by AWS. They’re usually categorized by date, so I can pull all the gzipped files for a specific day, search the archives, and only unzip and go into detail on files that match. Big time saver!

bat

bat bills itself as a ”cat clone with wings” The TL;DR on this one is:

  • Built in syntax highlighting and line numbers
  • Will automatically pipe to less if the output is large
  • Integration with git to show you if lines have been modified or added in the index

Need I say more?

fd

fd is an alternative to find. As with basically all of these Rust based tools, one of its biggest pros is that it is super fast. But in addition to that, I like using it because it has:

  • Sane defaults. I can just do fd foo instead of having to remember find -name "*foo*"
  • Color output
  • Like ripgrep, it ignores things in .gitignore by default

mcfly

This one is a hidden gem in my opinion. mcfly is an alternative to the default history search in your terminal when you press ctrl-r. I didn’t even know that was a thing until recently, and had always just used $ history | grep foo.

As with basically all the others, it has a nice color output, and shows a list of options instead of the single one that matches closest to what you’ve typed. Saves you a lot of time compared to grepping history, finding what you’re looking for, and then either copy/pasting, or using the !{num} shortcut. (Every entry in your history has a number next to it. If you type ! and then the number, your shell will rerun the command that was at that number in your history)


Written by James Quigley, an SRE/DevOps Engineer, and general tech nerd. Views and opinions are my own. Follow me on Twitter!