5 CLI Tools Made With Rust To Improve Already Popular Tools | by SotoEstevez | Sep, 2022

Upgrade some of your daily tools

0*6JSymCT6 QNqP1zU 300w
Photo by Seyed Sina Fazeli on Unsplash

One of the main purposes the community gave for Rust as it started to get traction was the recreation of some of the more popular command line tools. It’s easy to grasp the reason for this as soon as you develop your first command line app with Rust. The combination of a low-level language with crates like clap, structopt, or console and the easiness of publishing and installing the crates with cargo makes the development of this type of software a pleasure.

Today, we’ll see five command-line tools rewritten in Rust that will catch your eye with the improvements they bring to the table.

What is the only thing better than a cat? A bat. Well, maybe not, at the least if we are talking about mammals (I still do love bats, though), but in the context of a terminal, I have a point to prefer bat over cat.

bat is a command intended for the same as the UNIX built-in cat, but it features syntax highlighting and integrates with git showing the differences of the files. So, for developers like us, this is a nice improvement to a very common tool.

1*5GqbE vdf3SfyOVEFgxD g
The feline vs the critter she tells you not to worry about

To install bat, you can follow their README or just go the Rustacean way.

cargo install bat

ripgrep is FAST, like, blazingly fast. That’s the best description I can make of it. Based on the name alone, you can see what this crate accomplishes: substitute grep. These are big words, as grep is an incredibly handy tool of UNIX to search text recursively, but ripgrep is the same but FASTER.

It was first started by Andrew Gallant and features more than 300 contributors on its GitHub page. It supports a lot of encodings, can be case sensitive or not, follows .gitignores content, and a lot more. Look at some benchmarks its creator offers to know what I’m talking about.

cargo install ripgrep

If ripgrep upgraded grep based on speed, dust became an alternative for du focusing on brevity, commodity, and visualization. If you have used du in the past, you already know that the command is a synonym for extensive folder logging and messages about missing permissions.

Running dust, on the other hand, it will yield you a terminal height-based result with the tree of folders and even a graph displaying the disk usage visually. A single dust call usually gives all the information you need without the burden of adding flags or getting your terminal drowned in lines of text.

It was first started by Andy Boot and has more than 30 contributors on GitHub.

cargo install du-dust
Comparison of the outputs of dust and du

Now, if dust was already a nice jump in terms of data visualization in comparison with du, what bottom accomplishes is even wilder. To the point that I won’t say anything about it and will just let the images take care of selling this awesome tool to you.

Demo GIF from their GitHub repository

You can get guides for installation and usage on their webpage.

cargo install bottom

Finally, to close this article, we’ll be glaring at the king of UNIX only next to cd, the all-mighty ls. Very few commands do we write more than the good ol’ ls, to the point that oh my zsh already comes with a lot of aliases to write it even faster, like l or la.

This last case is the only one where I didn’t swap to the new modern tool, but exa can be very useful with its extra features like the colouring for the different types of files or its compatibility with Git.

exa and ls side to side

As with all the others, you can find the instructions on the README of the tool or go with cargo.

cargo install exa

And that’s all. I hope you liked it and found some new tools to use daily. See you soon!

News Credit

%d bloggers like this: