Htop this is an extended version of the top command. It displays all the processes running in the system by PID, as well as by uptime, average load, memory usage and other important statistics. It displays information in an orderly manner, which allows users to easily find system indicators. In this lesson, we will look at how we can obtain system information using HTOP team in CentOS8. It works on all Linux distributions and in most cases is installed by default.
To check if the package is installed or not, open a terminal and use the following command.
# rpm –q htop
As shown in the screenshot above, the package is not installed. To install the htop package on CentOS 8, open a terminal and use the following command.
# dnf install –y htop
After the installation is complete, it’s time to extract the system metrics, use the following command to do this.
It will extract all system metrics as shown below.
Htop command sections
There are different sections in the htop command, these sections are as follows.
- Title Section
- Footer section.
The header section shows information on system metrics that include CPU, memory usage, average load, tasks, swap usage, and uptime.
The body section contains metrics such as process identifiers, the user who owns the process, memory usage, processor and time, etc.
The footer section includes the htop menu section.
Now we can perform several actions using the htop command, these actions are as follows, and we will discuss this one by one.
- Sort output.
- A list of processes in a tree format.
- Filtration processes.
- Search process.
- Kill the process.
The Htop command provides several options for sorting output. To sort the metrics, go to the header parameter of the column by which you want to sort, and click on this parameter. In the screenshot attached below, I figured out according to memory usage. By default, it uses CPU% to sort.
List of processes in tree format:
To display a process in a hierarchical order, create a parent-child (inherited) relationship. To display metrics according to the ratio, click F5 function key. An example output is attached below.
We can also filter processes using HTOP command, for this click F4 function key. You will be prompted to enter a path to filter metrics and press the enter key in the footer section. In the output shown below, I displayed the process by specifying the path / Usr / libexec,
We can also search for a process using the htop command, for this use F3 softkey and enter the name of the process you want to find. This will highlight this particular process I was looking for libexec handle GSD colorThe image attached below is used for reference.
Kill the process:
To kill any process with HTOP command use F9 function key or letter TO, I selected a signal and pressed enter, this will kill the process.
For more help, use F1 function key. A list of options will appear in front of you, as shown below.
In this tutorial, we learned how to use HTOP Command in CentOS 8. We saw how to kill a process, sort processes, search for a specific process, filter the process and display the process according to the parent-child relationships. I hope this tutorial helps you better understand the htop command.
How to use htop to monitor system processes in CentOS 8