Gain new benefits by improving your old command-line tools with updated alternatives.
In our daily use of Linux/Unix systems, we use many command-line tools to complete our work and to understand and manage our systems—tools like du to monitor disk utilization and top to show system resources. Some of these tools have existed for a long time. For example, top was first released in 1984, while du’s first release dates to 1971.
Over the years, these tools have been modernized and ported to different systems, but, in general, they still follow their original idea, look, and feel.
These are great tools and essential to many system administrators’ workflows. However, in recent years, the open source community has developed alternative tools that offer additional benefits. Some are just eye candy, but others greatly improve usability, making them a great choice to use on modern systems. These include the following five alternatives to the standard Linux command-line tools.
1. ncdu as a replacement for du
The NCurses Disk Usage (ncdu) tool provides similar results to du but in a curses-based, interactive interface that focuses on the directories that consume most of your disk space.
ncdu spends some time analyzing the disk, then displays the results sorted by your most used directories or files.
You can use that to drill down into the directories and find which files are consuming the most disk space. Return to the previous directory by using the Left arrow key. By default, you can delete files with ncdu by pressing the d key, and it asks for confirmation before deleting a file. If you want to disable this behavior to prevent accidents, use the -r option for read-only access: ncdu -r.
2. htop as a replacement for top
htop is an interactive process viewer similar to top but that provides a nicer user experience out of the box. By default, htop displays the same metrics as top in a pleasant and colorful display.
In addition, htop provides system overview information at the top and a command bar at the bottom to trigger commands using the function keys, and you can customize it by pressing F2 to enter the setup screen. In setup, you can change its colors, add or remove metrics, or change display options for the overview bar.
While you can configure recent versions of top to achieve similar results, htop provides saner default configurations, which makes it a nice and easy to use process viewer.
3. tldr as a replacement for man
The tldr command-line tool displays simplified command utilization information, mostly including examples. It works as a client for the community tldr pages project.
This tool is not a replacement for man. The man pages are still the canonical and complete source of information for many tools. However, in some cases, man is too much. Sometimes you don’t need all that information about a command; you’re just trying to remember the basic options.
TLDR stands for “too long; didn’t read,” which is internet slang for a summary of long text. The name is appropriate for this tool because man pages, while useful, are sometimes just too long. In Fedora, the tldr client was written in Python. You can install it using dnf. For other client options, consult the tldr pages project.
In general, the tldr tool requires access to the internet to consult the tldr pages. The Python client in Fedora allows you to download and cache these pages for offline access.
4. jq as a replacement for sed/grep for JSON
jq is a command-line JSON processor. It’s like sed or grep but specifically designed to deal with JSON data. If you’re a developer or system administrator who uses JSON in your daily tasks, this is an essential tool in your toolbox.
The main benefit of jq over generic text-processing tools like grep and sed is that it understands the JSON data structure, allowing you to create complex queries with a single expression.
5. fd as a replacement for find
fd is a simple and fast alternative to the find command. It does not aim to replace the complete functionality find provides; instead, it provides some sane defaults that help a lot in certain scenarios.
For example, when searching for source-code files in a directory that contains a Git repository, fd automatically excludes hidden files and directories, including the .git directory, as well as ignoring patterns from the .gitignore file. In general, it provides faster searches with more relevant results on the first try. By default, fd runs a case-insensitive pattern search in the current directory with colored output. The same search using find requires you to provide additional command-line parameters.