How to use htop to monitor system processes in CentOS 8

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.

Install Htop

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

Install htop with the dnf command

After the installation is complete, it’s time to extract the system metrics, use the following command to do this.

# htop

Start htop

It will extract all system metrics as shown below.

Htop team on CentOS

Htop command sections

There are different sections in the htop command, these sections are as follows.

  • Title Section
  • body
  • Footer section.

Title Section:

The header section shows information on system metrics that include CPU, memory usage, average load, tasks, swap usage, and uptime.

Title Section

ads

Body Section:

The body section contains metrics such as process identifiers, the user who owns the process, memory usage, processor and time, etc.

process list

Footer Section:

The footer section includes the htop menu section.

htop menu

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.

Output Sort:

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.

Sorting

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.

Tree view

Filtration Processes:

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,

Filtration processes

Search process:

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.

Process search

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. Kill a process with htop

Get help:

For more help, use F1 function key. A list of options will appear in front of you, as shown below.

Help

Conclusion

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

Sidebar