Introduction
Linux systems ship with monitoring tools by default like top
, df
, and du
that help monitor processes and disk space. Often times though, they are not very user/visual friendly. We’ll be setting up three friendlier versions of the previously mentioned tools (htop
, ncdu
, pydf
) to help better monitor our VM instances.
Installation
On Debian/Ubuntu systems use:
sudo apt-get -y install htop ncdu pydf
On Redhat/CentOS systems use:
sudo yum -y install htop ncdu pydf
Note that ‘-y’ flag in both cases above auto answers “yes” during installs.
Usage
htop (interactive process viewer)
On your terminal, type in htop
and press ENTER. You will see a colorful display listing all running processes as well as the percentage of CPU, Memory and Swap that your system is using. Press q
to exit. Compare this to running just the top
command.
ncdu (disk usage analyzer)
On your terminal, type in ncdu
and press ENTER. You will see a list of all files and folders in the current directory you in are with a visual bar showing the relative amount of space they are using. Press q
to exit. Compare this to running the standard du
command.
You can also type in ncdu [directory-path]
to see disk usage stats for any directory. One fantastic feature ncdu has is the ability to navigate directory structures. This allows it to drill down and get even more disk usage stats for sub-directories.
pydf (disk usage checker)
On your terminal, type in pydf
and press ENTER. You will see a colorful summary of the disk usage on your system. Contrast this to running the standard df
command.
Conclusion
These new tools provide a more user-friendly way to analyze running processes and disk usage on a server. Each of these tools should be in the toolkit of anyone (Admins, DevOps, etc.) who manages linux servers.