4 Classic Linux Tools with Better Modern Alternatives
There are several command-line utilities that Unix and Linux users have relied on for over 50 years. However, each of these classic commands has a modern replacement if you're looking to upgrade.
These programs are not available by default so you will need to install them yourself. And it's best to use them locally, for one-off tasks, rather than relying on them for scripting. Nonetheless, you might find a handy feature here, whether it's syntax highlighting, faster processing, or simply a more intuitive interface.
1. bat is cat with syntax highlighting and Git integration
Short for “concatenate”, the cat tool is probably least used to concatenate files together but rather to display them. Since it sends input to standard output, cat creates a general-purpose file viewer, very basic. However, you often want more features when viewing file contents and bat is a specific tool designed to deliver those features.
bat is great for quickly paging through text files, like a collection of logs or source code. It provides headers for each file, adds line numbers, and uses colors to highlight syntax for various kinds of files. The bat command is compatible with other popular tools and has high compatibility with cat's option set.
If you're a programmer, you will appreciate bat's Git integration. Its output will include annotations for lines that have local changes in the margin. You can even set it up to act as the default viewer for man pages, improving their readability.
2. ripgrep is a recursive grep
grep serves many purposes as a powerful search tool. By leveraging the power of regular expressions, text searching ascends to a new level. ripgrep has two major improvements: Recursive search and Git integration.
The standard grep tool can perform a recursive search within subdirectories with the -R option, making searching through all files in a project much more convenient. But ripgrep does this by default. ripgrep respects any .gitignore files it finds, so it won't search files not included in the repository.
ripgrep also tends to run faster than grep and its alternative options. And its default output is likely what you're looking for, with syntax highlighting and line numbers.
3. lsd is ls with better formatting
The ls command is one of the first commands Linux users learn as it's one of the most useful ones. This tool - short for LSDeluxe - upgrades it with beautiful colors and graphical icons.
Like ls's -G option, lsd adds color for each file depending on its type: Directory, executable, symlink, etc. But it also adds icons representing file formats, from HTML files to C source code. It turns the standard terminal file list into something that looks more like a GUI file explorer.
lsd also comes with a --tree option providing hierarchical output without needing a separate tool.
4. fd is a more user-friendly find
Among all the standard command-line utilities, find is perhaps the most cumbersome to use. It's a valuable way to find files, but its syntax and overall usage are quite unique. Therefore, it can be hard to remember how to use find correctly. If so, try fd!
With no arguments, fd will provide you with a color-coded list showing all files and directories beneath the current directory. You can give it plain text or a pattern to search for specific file names.
The fd command supports various other options, from case sensitivity to searching for file extensions and executing commands. Like ripgrep, it respects any .gitignore settings it finds, meaning it's a particularly good tool for searching through source code repositories.