Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use htop to monitor the process of Linux system

2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to use htop to monitor the process of Linux system", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use htop to monitor the process of Linux system" this article.

Htop is a command-line utility that is an improved version of the top command. It shows key system metrics, such as tasks running, pid, uptime, average load, memory utilization, and other important statistical loads.

What sets htop apart from its predecessor, the top command, is its ability to display system metrics in a more organized manner and in different color schemes. This allows users to visually find the system metrics they want, compared to the normal and boring top command utilities.

In this guide, we will show you how to take full advantage of the htop command utility to retrieve various system metrics. Htop works across all Linux distributions, and in most cases newer versions are preinstalled. To start htop and display system metrics, simply type the command htop.

Linuxmi@linuxmi:~/www.linuxmi.com$ htop

Part of the htop command

From the previous output, we can clearly see that the display of htop is divided into three parts:

Head:

The header section shows system metrics, including CPU, memory and swap utilization, running tasks, average load, and uptime.

Subject:

This section lists all running processes.

Footer:

Show htop menu options

Some of the advantages of using the htop command include:

Ability to interact with htop tools using the mouse.

The system indicators are color-coded for easy identification at a glance.

Linuxmi@linuxmi:~/www.linuxmi.com$ sudo dnf install htop

Htop provides a way to terminate a process without calling the process PID.

You can scroll up and down using the mouse or arrow up and down arrow keys to see all running processes.

Sometimes, you may receive a warning when you are working on a system that does not have htop installed. To install htop, run the following command:

For Debian/ Ubuntu/Mint

Linuxmi@linuxmi:~/www.linuxmi.com$ sudo apt install htop

For RHEL / CentOS

Linuxmi@linuxmi:~/www.linuxmi.com$ sudo yum install htop

For Fedora 22 and later

Linuxmi@linuxmi:~/www.linuxmi.com$ sudo dnf install htop

Use the htop command

Now let's look at the various options that come with the htop utility.

Sort output

Htop provides several options that you can use to sort the output. To see the output options, simply press the F6 function key on the keyboard. On the left, scroll and select the condition to use when sorting the output. By default, it is set to the PERCENT_CPU option.

To sort using the percentage of memory usage, use the down arrow key and press ENTER on the PERCENT_MEM option.

List processes in a tree format

Linux processes are usually arranged in hierarchical order to create a child-parent relationship. To display the relationship, simply press the F5 function key.

Filtration process

Linux processes can also filter based on their respective paths. To filter the process, press the F4 function key. You will be prompted to enter the path of the process in the footer section. In the following output, I show the progress as the / usr/sbin path.

Search process

You can also search for a process by pressing F3 and entering the process name in the search prompt that appears at the bottom of the terminal screen.

For example, in this case, I search the / usr/lib path for the tomcat process. Once found, the process is highlighted in yellow.

Kill a process.

After starting htop, simply scroll to the process you want to terminate or "kill". In this case, I chose Nginx with a PID of 1513.

Next, press the F9 function key or the letter k to select the signal to send. In this case, I chose SIGKILL to ensure that the process exits. Finally, press enter.

How to customize htop output

To make some adjustments here and there that will determine what your output looks like, press F2. There are several options for changing system indicators such as color and font style to give a few examples.

Get help

For help on how to use htop to find ways and make the best use of the various shortcuts, simply press F1. The key options and their roles are displayed as follows.

The above is all the contents of the article "how to use htop to monitor the process of Linux system". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report