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.
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, like this:
ncdu 1.14.2 ~ Use the arrow keys to navigate, press ? for help --- /home/rgerardi ------------------------------------------------------------ 96.7 GiB [##########] /libvirt 33.9 GiB [### ] /.crc 7.0 GiB [ ] /Projects . 4.7 GiB [ ] /Downloads . 3.9 GiB [ ] /.local 2.5 GiB [ ] /.minishift 2.4 GiB [ ] /.vagrant.d . 1.9 GiB [ ] /.config . 1.8 GiB [ ] /.cache 1.7 GiB [ ] /Videos 1.1 GiB [ ] /go 692.6 MiB [ ] /Documents . 591.5 MiB [ ] /tmp 139.2 MiB [ ] /.var 104.4 MiB [ ] /.oh-my-zsh 82.0 MiB [ ] /scripts 55.8 MiB [ ] /.mozilla 54.6 MiB [ ] /.kube 41.8 MiB [ ] /.vim 31.5 MiB [ ] /.ansible 31.3 MiB [ ] /.gem 26.5 MiB [ ] /.VIM_UNDO_FILES 15.3 MiB [ ] /Personal 2.6 MiB [ ] .ansible_module_generated 1.4 MiB [ ] /backgrounds 944.0 KiB [ ] /Pictures 644.0 KiB [ ] .zsh_history 536.0 KiB [ ] /.ansible_async Total disk usage: 159.4 GiB Apparent size: 280.8 GiB Items: 561540
Navigate to each entry by using the arrow keys. If you press Enter on a directory entry, ncdu
displays the contents of that directory:
--- /home/rgerardi/libvirt ---------------------------------------------------- /.. 91.3 GiB [##########] /images 5.3 GiB [ ] /media
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
.
ncdu
is available for many platforms and Linux distributions. For example, you can use dnf
to install it on Fedora directly from the official repositories:
$ sudo dnf install ncdu
You can find more information about this tool on the ncdu
web page.
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.