Top 9 Rust Based CLI Tools You Need to Try Now!
Exploring Rust-Based Alternatives for Linux Command Line Tools
Summary of the Content Prior to Reading the Article
In this article, we explore a selection of Rust-based command line tools that enhance the Linux ecosystem with improved performance and modern features. These tools, including exa, fd, bat, ripgrep, and more, provide innovative alternatives to traditional utilities with capabilities like syntax highlighting, fast searching, and file management. They are cross-platform, making them accessible for Linux, Windows, and Mac users. Discover how these tools can streamline and enrich your command line experience.
The Linux ecosystem is continuing to evolve, and developers are increasingly looking for alternatives to traditional command line tools that will not only offer improved performance but also leverage new features and modern programming paradigms. One such paradigm gaining traction is Rust, known for its safety, speed, and efficiency.
In this blog post, we will explore some of the best Rust-based command line tools that are making waves in the Linux community. These tools offer familiar functionalities to some older Linux CLI Tools but with enhanced capabilities and features that can significantly improve your workflow.
And here the good news is - These tools are cross platform, whether you use a Linux, Windows or Mac computer, all these tools are accessible to you.
So, what weβre waiting for? Letβs get started!
1. exa
exa
is a modern replacement for ls
, the classic directory listing utility.
Key Features
Syntax highlighting with colors for file types, users, and more.
Tree view option (
exa -T
orexa --tree
) for easier visualization of directory structures.Enhanced file metadata display, including git status, file size, gitignore and user permissions.
Easy to use with several command line options, mimicking the
ls
interface while offering more useful information.
Usage Example
Longer View with hidden files and numerical info in human readable format
exa -alhF
Try these two in a git repository
exa -alhF --git
exa --git-ignore # ignore files mentioned in '.gitignore'
I always like exa to group directories first then any other file. Also, I have set a Nerd Font as my terminal font. So, I can see icons also in my terminal emulator. Thatβs why I love to use the --icons
flag with the command.
I preferred to set this command exa -ah --icons --group-directories-first
as an alias to la
.
alias la='exa -ah --icons --group-directories-first'
Install Using
sudo apt install eza # Debian/Ubuntu 23+
scoop install eza # windows (using the scoop package manager)
winget install eza-community.eza # windows (using winget)
brew install eza # MACOS (using homebrew)
Visit the GitHub of eza to learn more.
2. fd
fd
is a simple and fast alternative to find
, the Linux file searching command.
Key Features
Speed and ease of use with sensible defaults.
Support for regex searches, including fuzzy matching.
Colors and icons for better visual output.
Automatically respects your
.gitignore
to prevent searching unwanted files.
Usage Example
fd <pattern>
For more examples I think the gif below is enough. π
read the help texts and manpage for more detailed overview..
On Debian/Ubuntu, the command is fdfind
instead of fd
.
Install Using
sudo apt install fd-find # for Debian/Ubuntu 19+
brew install fd # for MACOS (via homebrew)
scoop install fd # for windows (via scoop)
winget install sharkdp.fd # for windows (via winget)
Visit the fd GitHub to learn more about this command.
3. Bat
bat
serves as a modern replacement for cat
, showcasing file contents in a more stylish way.
Key Features
Syntax highlighting for numerous programming languages.
Line numbers and Git integration for improved context.
Ability to view file differences with
--diff
.Built-in pagination for lengthy files with
less
.highly customizable with many different themes.
Usage Example
bat file.txt
To apply output without paging -
bat file.md --paging=never
In Debian/Ubuntu, the command is batcat
instead of bat
.
The best part is you can easily integrate bat with other cli tools to show preview of files with syntax highlighting. How cool is that!
Install Using
sudo apt install bat # Debian/Ubuntu 20+
brew install bat # MACOS
winget install sharkdp.bat # windows winget
scoop install bat # windows scoop
Visit the bat GitHub for to learn more.
4. Grex
grex
is a powerful tool for generating regex patterns from simple, human-readable expressions.
Key Features
Converts plain text patterns into regular expressions.
Supports complex regex constructs in easily understandable syntax.
Optional syntax highlighting for nicer output in supported terminals.
Can be used as a library in your rust project.
Usage Example
grex "example pattern"
Install Using
brew install grex # homebrew (MACOS)
scoop install grex # scoop (windows)
cargo install grex # Ubuntu/Debian
Visit grex
GitHub to learn more -
5. Ripgrep
ripgrep
, abbreviated as rg
, is a line-oriented search tool that recursively searches your current directory for a regex pattern.
Key Features
Extremely fast due to its efficient search algorithm and being multithreaded.
Ignores files and directories specified in
.gitignore
, making it perfect for codebases. Imagine how easy it will be to contribute to open-source projects because you will be able to spot errors, and actually perform any critical project search faster than faster. This is the reason ripgrep is considered as an ideal choice as a tool for large codebases.Offers different flags for search customization, including support for file type filtering.
Usage Example
rg "search_pattern"
Read this user guide or open the man page - enter man rg
in the terminal to read the detailed documentation for learning how to use ripgrep like a pro.
Install Using
brew install ripgrep # Homebrew (MACOS)
scoop install ripgrep # Scoop (Windows)
sudo apt install ripgrep # Ubuntu 18.10+
Visit the Ripgrep GitHub to learn more about it.
6. Yazi
Yazi is a Blazingly fast terminal file manager written in Rust, based on asynchronous I/O.
Key Features
Incremental Find.
Scrollable preview.
Vim-like Input & Select Component.
Multi-Tab, FZF and Bulk Rename.
Install Using
# MACOS (homebrew)
brew install yazi ffmpegthumbnailer sevenzip jq poppler fd ripgrep fzf zoxide imagemagick font-symbols-only-nerd-font
scoop install yazi # windows (scoop)
# Install the optional dependencies (recommended):
scoop install 7zip jq poppler fd ripgrep fzf zoxide imagemagick
winget install sxyazi.yazi # windows (winget)
# Install the optional dependencies (recommended):
winget install 7zip.7zip jqlang.jq sharkdp.fd BurntSushi.ripgrep.MSVC junegunn.fzf ajeetdsouza.zoxide ImageMagick.ImageMagick
Ubuntu/Debian users need to install yazi via cargo.
See installation instructions.
Visit the Yazi GitHub to learn more.
7. Tokei
tokei
provides statistics on the source code of a project.
Key Features
ACCURATE!!! Counts lines of code, comments, and blanks across various programming languages. Does not count comments that are in strings.
Supports multiple formats (YAML, CBOR, JSON) of output to be easily stored and reused.
Provides a library allowing you to easily integrate it with other projects.
Supports over 150 languages.
Respects .gitignore and all other .ignore files.
Example output for some codebase -
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Language Files Lines Code Comments Blanks
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
BASH 4 49 30 10 9
JSON 1 1332 1332 0 0
Shell 1 49 38 1 10
TOML 2 77 64 4 9
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Markdown 5 1355 0 1074 281
|- JSON 1 41 41 0 0
|- Rust 2 53 42 6 5
|- Shell 1 22 18 0 4
(Total) 1471 101 1080 290
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Rust 19 3416 2840 116 460
|- Markdown 12 351 5 295 51
(Total) 3767 2845 411 511
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Total 32 6745 4410 1506 829
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Usage Examples
tokei ./dir # Basic Example
tokei ./one ./another # Supports multiple directories at once
tokei ./dir --exclude *.py # option to exclude any additional files
tokei ./foo --output json # save output as JSON
Additionally, paths to exclude can also be listed in a .tokeignore
file. The syntax is the same as .gitignore
.
Install Using
# Homebrew (MACOS)
brew install tokei
# Windows
# winget
winget install XAMPPRocky.tokei
# Scoop
scoop install tokei
# For Debian/Ubuntu
# Install with cargo
cargo install --git https://github.com/XAMPPRocky/tokei.git tokei
Visit the tokei
GitHub to learn more -
8. Qsv
qsv
is a command line tool designed for working with CSV files.
Key Features
High-performance CSV querying and manipulation.
Integration with SQLite for complex queries on CSV files.
Provides multiple operations, like sorting, filtering, and aggregating.
Usage Example
Install Using
brew install qsv # Homebrew (MACOS)
scoop install qsv # scoop on windows
# For Ubuntu/Debian users
wget -O - https://dathere.github.io/qsv-deb-releases/qsv-deb.gpg | sudo gpg --dearmor -o /usr/share/keyrings/qsv-deb.gpg
echo "deb [signed-by=/usr/share/keyrings/qsv-deb.gpg] https://dathere.github.io/qsv-deb-releases ./" | sudo tee /etc/apt/sources.list.d/qsv.list
sudo apt update
sudo apt install qsv
Visit the qsv
GitHub to learn more -
9. Onefetch
onefetch
is a command line tool for displaying information about a repository in a neat and visually appealing manner.
Key Features
Shows a summary of project details like languages used, contributor statistics, and more.
ASCII art of the logo of the project adds a little flair.
A
neofetch
like interface.automatically detects open-source licenses from texts and provides the user with valuable information like code distribution, pending changes, number of dependencies (by package manager), top contributors (by number of commits), size on disk, creation date, LOC (lines of code), etc.
Customizable output format to fit preferences.
Usage Examples
onefetch # must be run inside a git repository
Install Using
brew install onefetch # MACOS (homebrew)
# Windows
# via scoop
winget install onefetch
# via scoop
scoop bucket add extras
scoop install onefetch
# Ubuntu (ppa)
sudo add-apt-repository ppa:o2sh/onefetch
sudo apt-get update
sudo apt-get install onefetch
Visit the onefetch
GitHub to learn more -
Conclusion
The Rust programming language is reshaping the landscape of command line tools in Linux, providing faster, safer, and more user-friendly alternatives to well-established utilities. By integrating tools like exa
, fd
, bat
, and others into our daily routines, we can look forward to more efficient, relaxing and enjoyable development experiences.
Try them out and experience the power of these new Rust-based command line tools in your terminal!
If you found this POST helpful, if this blog added some value to your time and energy, please show some love by giving the article some likes and share it with your developer friends.
Feel free to connect with me at - Twitter, LinkedIn or GitHub :)
Happy Coding π§π½βπ»π©π½βπ»! Have a nice day ahead! π