The top command is a handy command-line tool that displays running processes on a Linux system in real-time. It provides a summary of all the processes being handled by the Linux kernel and some vital system metrics such as uptime, load average, and resource usage (CPU & memory usage).
Htop is an improved implementation of the top command, which is a text-mode interactive process viewer that provides real-time interactive monitoring of processes and metrics in a colorized output. It is more intuitive and provides a much more appealing look at the running processes and metrics.
In this guide, we focus on how to install htop on Alpine Linux.
Installing Htop in Alpine Linux
Let’s first search for the availability of the package on the Alpine Linux repositories using the following apk command.
# apk search htop
This populates the following output, that proves the availability of the package from the official repositories.
To install htop, run the command:
# apk add htop
To verify that the package has been installed, run the command:
# apk info htop
The output provides information about the Htop package such as a brief description, website URL, and installed size.
To launch Htop, run the following command on the terminal.
# htop
This presents a text-mode process viewer as shown. In the upper section, you find system metrics in real-time such as resource utilization, tasks running, load average, and uptime.
You can further filter the results to list processes owned by a specific owner as shown.
# htop -u tecmint
The same holds true for processes. For instance, the command below displays processes associated with Apache.
# htop --user=apache
Alternatively, you can list processes by PID as follows:
# htop -p PID
For multiple PIDs, run the command:
# htop -p PID1, PID2
For more command options, run the command:
# htop --help
This wraps up our guide today. Check out the Htop webpage for more information.