How to Install Htop to Monitor Alpine Linux

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.

Search Htop in Alpine Linux
Search Htop in Alpine Linux

To install htop, run the command:

# apk add htop
Install Htop in Alpine Linux
Install Htop in Alpine Linux

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.

Check Htop in Alpine Linux
Check Htop in Alpine Linux

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.

htop Linux Process Viewer
htop Linux Process Viewer

You can further filter the results to list processes owned by a specific owner as shown.

# htop -u tecmint
List User Running Processes
List User Running Processes

The same holds true for processes. For instance, the command below displays processes associated with Apache.

# htop --user=apache
Check Apache Linux Process
Check Apache Linux Process

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.

Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.