Why does Linux's htop command win the top command?

Source: Internet
Author: User
In Linux, the top command is used to display the real-time status of processes running in the system. it displays some useful information, such as CPU utilization and memory consumption, and the status of each process. But, do you know? There is another command line tool hto

In Linux, the top command is used to display the real-time status of processes running in the system. it displays some useful information, such as CPU utilization and memory consumption, and the status of each process. But, do you know? There is another command line tool 'htop', which is similar to the traditional top command, but it has more powerful functions and can display more information. In this article, we will use examples to discuss the 'htop' command.

Htop commands in Linux

The following is a description extracted from the htop manual page:

 

  • It is similar to the top command, but it allows you to scroll vertically and horizontally, so you can see all the processes running on the system and their complete command lines.
  • You can perform related operations (killing and renicing) on the process without entering the PID of the process ).

 

First understand its output

The htop command displays information in an intuitive format. The output snapshot of HTOP is as follows:

If you observe the upper left corner of the window, you will see the real-time information of CPU load, memory consumption, and swap space, the upper-right corner contains information about tasks, threads, average loads, and system running time.

The average load section provides three numbers, which only indicates the average load of the system in the past 5 minutes, 10 minutes, and 15 minutes. in a single-core system, the average load of 1 indicates a CPU usage. Finally, the running time (uptime) indicates the total time from system startup to the current running time.

Next, we will use examples to further discuss this command.

1. use the F2 key to edit the configuration

The htop Command provides many custom options. all you need to do is to press F2 from the main window.

The following are available custom options:

You only need to use the arrow keys to select and change specific settings.

2. send signals through the F9 key

The htop command allows you to easily send arbitrary signals to a process in the htop window. Press the F9 key.

As you can see, the left part of the window lists all available signals, and the right part lists processes. As long as you select a signal and select a process, and then press enter, the selected signal will be sent to this process.

3. display the process Tree View

The htop command also provides the process Tree View function. Press F5 to switch.

The following is an example of the htop tree view:

To exit the tree view mode, press F5 again.

4. search for processes by using the F3 key

The htop Command provides an easy-to-use method to search for processes. Press the F3 key and a text box will appear at the bottom of the window.

The following is an example:

As you can see, a text prompt box named 'search' appears at the bottom of the window, where you can enter the name of the process and press enter to search. If found, it will highlight the process in the list of processes listed.

5. use the space key to set the color annotation process entries

In the real-time process view running in the system, it is a big problem to track a process. The entire list is constantly refreshed, and the process order is changing. To solve this problem, htop provides a very simple solution: color labeling. Yes, you can mark a process entry and it will be displayed in different colors, so it is easy to trace it.

To mark a process entry, select the entry and press the 'space' key. For example, in the following example, three process entries are marked by color:

Therefore, you can easily track the processes you want to view.

6. command line options

In addition to some hotkeys described above, htop also provides useful command line options. Below are some of them:

  • -S option: Sort by specified column. For example, the htop-s PID command is sorted by the size of the PID column.
  • -U option: displays the process information list of the specified user. For example, the htop-u himanshu command only displays the processes with the username himanshu.
  • -D option: Set the refresh delay time. For example, the htop-d 100 command will refresh the output after 1 second (the unit of parameter-d is 10 microseconds ).
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.