These 4 Classic Linux Tools Have Better Modern Alternatives

These 4 Classic Linux Tools Have Better Modern Alternatives

There are some command-line utilities that Unix and Linux users have depended upon for over 50 years. But each of these classic commands has a modern alternative, if you fancy an upgrade.

These programs are not universally available, so you’ll need to install them yourself. And it’s best to use them locally, for one-off tasks, rather than depending on them for scripting. Still, you may discover 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 used less for joining files together and more to simply display them. Since it sends its input to standard output, cat makes for a very basic, general-purpose file viewer. But you’ll usually want more features when viewing file contents, and bat is a specific tool designed to offer them.

Output of the linux bat command showing the contents of two files with syntax highlighting and line numbers.

bat is great for quickly paging through text files, like a set of logs or source code files. It gives you a header for each file, adds line numbers, and uses color to highlight the syntax of many different file types. The bat command supports use with other common tools and is highly compatible with cat’s set of options.

If you’re a programmer, you’ll appreciate bat’s git integration. The tool’s output will include annotations for lines with local changes, in the sidebar. You can even set it up to work as the default viewer for manual pages via man, improving their readability.


2 ripgrep Is a Recursive grep

grep has many uses as a sort of powerhouse search tool. Utilizing the power of regular expressions, it takes text searching to the next level. ripgrep has two main improvements: recursive search and git integration.

Output of the linux ripgrep command showing a text search with matches in 4 files.

The normal grep tool will recursively search inside subdirectories with the -R option, which makes it much more convenient to search through all files in a project. But ripgrep does this by default—and there’s more. ripgrep honors any .gitignore files it finds, so it won’t search files that don’t belong in your repository.

ripgrep also tends to run more quickly than grep and other alternatives. And its default output is probably what you’re usually looking for, with syntax highlighting and line numbers as standard.


3 lsd Is ls With Fancy Formatting

The ls command is one of the first that Linux users learn because it’s one of the most useful. This tool—which stands for LSDeluxe—upgrades it with pretty colors and graphical icons.

Output of the linux lsd command showing colored file types and a tree layout.

Like ls’s -G option, lsd adds color to each file depending on its type: directory, executable, symlink, etc. But it also adds icons representing file format, from HTML files to C source code. It turns normal terminal file lists into something looking more like a GUI file browser.

lsd also comes with a –tree option which gives you hierarchical output without the need for a separate tree tool.


4 fd Is a Friendlier find

Of all the standard command-line utilities, find is possibly the most awkward to use. It’s an valuable way to find files, but the command’s syntax and general usage is pretty unique. As a result, it can be tricky to remember how to use find correctly. Enter fd.

Output of the linux fd command showing files matching given names and extensions.

With no arguments, fd will give you a color-coded list showing all files and directories underneath the current directory. You can pass it simple text or a pattern—either a regular expression or a glob—to search for specific filenames.

The fd command supports many other options, from smart case sensitivity to file extension searches and command execution. Like ripgrep, it honors any .gitignore settings it finds, meaning it’s a particularly good tool to search through sourcecode repositories.


Related posts