In a Linux system, the top command is used to display the real-time status of a running process in the system, and it shows some very useful information, such as CPU utilization, memory consumption, and each process situation. But, you know what? There is another command-line tool ' Htop ', which is the same as the traditional top command, but it has more powerful features and can display more information. In this article, we will use an example to discuss this ' htop ' command.
The Htop command in Linux
Here is a description of the excerpt from Htop's hand album:
It is similar to the top command, but allows you to scroll vertically and horizontally, so you can see all the processes running on the system, as well as their complete command line.
This process can be manipulated without the input of the PID of the process (killing, renicing).
First understand the output of it
The htop command displays information in an intuitive format. The following is an output snapshot of HTOP:
650) this.width=650; "Src=" https://dn-linuxcn.qbox.me/data/attachment/album/201406/03/005732l22oo5a53fam6y3o.png "alt=" Htop "/>
Htop
If you look at the upper-left corner of the window, you'll see real-time information about the CPU load, memory consumption, and swap space, and the upper-right corner contains information about tasks, threads, average load, and system uptime.
The average load section provides three numbers, which represent only the average load of the last 5, 10, and 15-minute systems, with an average load of 1 in a single-core system representing a total CPU utilization. Finally, the elapsed time (uptime) indicates the total elapsed time from the start of the system to the current run.
Below, we will use an example to further discuss this command.
1. Edit the configuration with the F2 key
The Htop command provides a number of customization options, all you have to do is press the F2 key from the main window.
The following are the available customization options:
650) this.width=650; "Src=" https://dn-linuxcn.qbox.me/data/attachment/album/201406/03/005734jkbtcubuaspcw5pt.png "alt=" Htop-settings "/>
Htop-settings
Just use the arrow keys to select and change specific settings.
2. Send the signal via the F9 key
The Htop command allows you to easily send an arbitrary signal to a process within the Htop window. Press the F9 key.
650) this.width=650; "Src=" https://dn-linuxcn.qbox.me/data/attachment/album/201406/03/005736oz455s422g11n2u2.png "alt=" signals "/>
Signals
As you can see, the left part of the window lists all available signals, and the right part lists the processes. As soon as the signal is selected and a process is selected, and the ENTER key is pressed, the selected signal is sent to this process.
3. Display a tree view of the process
The Htop command also provides a tree view of the process view function. Press the F5 key to toggle.
Here is an example of htop displaying tree view information:
650) this.width=650; "Src=" https://dn-linuxcn.qbox.me/data/attachment/album/201406/03/005737mzfdehve9k9d4h9u.png "alt=" TreeView "/>
Treeview
To exit the tree view mode, press the F5 key again.
4. Search the process by F3 key
The Htop command provides an easy-to-use way to search for processes. Press the F3 key and a text box will appear at the bottom of the window.
Here is an example:
650) this.width=650; "Src=" https://dn-linuxcn.qbox.me/data/attachment/album/201406/03/005739uh0xoeblqla8bn80.png "alt=" Search "/>
Search
As you can see, a text cue box called ' Search ' appears at the bottom of the window where you enter the name of the process and then enter the search. If found, it highlights this process in the list of processes listed.
5. Use the SPACEBAR to set the color callout process entry
In a real-time process view running in the system, it is a big problem to track a process. Because the entire list is constantly refreshed, the sequence of processes is changing. To solve this problem, Htop provides a very simple solution: color labeling. Yes, you can label a process entry, which is displayed in a different color, so it's easier to track it.
To label a process entry, you need to select the entry, and then press the ' SPACEBAR ' key. For example, in the following example, I have color-coded three process entries:
650) this.width=650; "Src=" https://dn-linuxcn.qbox.me/data/attachment/album/201406/03/005741jvcowsa19c9nzprg.png "alt=" Color-tag "/>
Color-tag
So with this approach, you can easily track the processes you want to see.
6. Command-Line Options
In addition to some of the hotkeys described above, Htop also provides useful command-line options. Here are some of them:
- s option : Sorts by the specified column. For example, thehtop-s pid command is displayed according to the size of the PID column.
- u option : Displays a list of process information for the specified user. For example, thehtop-u himanshu command displays only the related processes with the user name Himanshu.
- d option : Sets the delay time for the refresh. For example, thehtop-d command causes the output to refresh after 1 seconds (the parameter-D unit is 10 microseconds).
This article is from the "LINUX Super Dream" blog, make sure to keep this source http://215687833.blog.51cto.com/6724358/1788493
Htop command to win the top command