Linux comes with a lot of great command-line tools out of the box, but there are even better alternatives available for a good number of them. I'm not talking about obscure tools that you'd reserve for niche scenarios, but common staples that every Linux user is intimately familiar with, like ls, cat, grep, and man. Despite the ubiquity of these commands, I've replaced them with superior options and mostly stopped using them.
6 CLI tools I install before anything else on a new Linux machine
I've set up these terminal utilities on every Linux system in my arsenal
Your file listings deserve better than ls
eza replaces ls and is aware of your projects
At first, I was using eza because of the way it integrates with git repos. You can run it inside of your repo, and it lists each file, along with its git status: modified, staged, untracked. This saves me from executing git status just to figure out what has changed.
But then I found out that it's also just a better-looking version of ls. It has human-readable file sizes and syntax highlighting for file types turned on automatically (no need to supply extra flags). And it also replaces the tree command with eza -T, helping me navigate directory structures easily.
Reading files with cat feels ancient
bat is a modern spin on classic cat
The cat command is as bare-bones as you can get for reading files. bat does the same thing, except when a file's contents exceed your screen height, it pipes the output through a pager so you can scroll through it, rather than having it flood past you all at once. It also has syntax highlighting for programming and markup languages, and it shows line numbers by default.
As a bonus feature, bat is git-aware, meaning that it will tell you what lines have been added or modified from the last commit, right there in the gutter alongside the code.
There's really no reason to use top anymore
htop is the process monitor top always should have been
A lot of useful information can be extracted from top, but it's not user-friendly at all. Alternatives like htop display the same information but make it very easy to digest, even at just a glance. htop also recognizes your mouse clicks, so clicking on the CPU column will sort processes by their CPU usage.
Some users prefer btop or bashtop instead of htop, but I think htop strikes the right balance between features and ease of use. Other alternatives look too flashy, and I still think that a process monitor should be boring and focus on functionality.
The output from du is cumbersome to process
dust shows exactly where your disk space went
I usually run du -sh * when I want to see which directories are consuming the most space. But this also involves piping to sort. Running it recursively is when things get hectic because my terminal gets filled with directory paths. The dust (du + rust, as it's written in Rust) command gives us a better way.
When running dust, it sorts and visualizes disk usage, giving you a tree view of which directories are consuming the most space, and a proportional bar chart alongside each entry. This makes it a lot easier to identify which directories are consuming a lot of space, and you don't need any extra options or piping to other tools.
man pages are great, but often too comprehensive
tldr gives practical examples instead of a wall of documentation
Sometimes I'll skip the man page for a command and just do a quick online search instead. It's not because the man pages don't contain the information I need, but because they contain so much information that it's cumbersome to parse through.
tldr gives a brief explanation of the command in question and a handful of practical examples with the most common flags, and I don't need to leave my terminal. Usually, the info from tldr is all I need to know, and it's much faster than perusing the whole man page. If I want to know every possible option, I still check man instead.
grep works but doesn't respect .gitignore
ripgrep is the ideal search tool
If you're working with git repos or anything involving code, ripgrep will save a lot of time and probably end up replacing grep completely, as it did for me. ripgrep ignores the files listed in .gitignore, as well as binary files, unless you explicitly tell it not to.
It also includes line numbers and color highlighting by default, and accepts extended regex without needing an extra flag. Its performance advantage over regular grep is a welcome bonus, but the extra features are what I keep it for.
A bigger toolbox never hurts
I'm not saying that the default command-line tools that Linux comes bundled with aren't fantastic. They are. But I've been impressed by many of the open-source commands that are easy to install on almost any Linux distro because they're included in default repos. These alternatives have completely replaced the default commands for me.
