A process management tool that replaces top under Linux htop

Source: Internet
Author: User
Tags gpg cpu usage

I. Introduction of HTOP

This is htop, a interactive process viewer for Linux. It is a text-mode application (for console or X terminals) and requires ncurses.

Comparison between Htop and top

    • In ' htop ' can scroll the list vertically and horizontally to see all processes and complete command lines.

    • In ' top ' is subject to a delay for each unassigned key-press (especially annoying when multi-key escape sequences is triggered by accident).

    • ' Htop ' starts faster (' top ' seems to collect data for a while before displaying anything).

    • In ' htop ' You don't need to type the process number to kill a process, in ' top ' you do.

    • In ' htop ' You don't need to type the process number or the "priority value to renice a" process, in ' top '.

    • ' Htop ' supports mouse operation, ' top ' doesn ' t

    • ' Top ' is older, hence, more used and tested.

Htop is an interactive process viewer in a Linux system, and a text-mode application (in the console or X terminal) requires ncurses.

Htop is more user-friendly than the traditional Linux top. It allows users to interact interactively, support color themes, scroll through the list of processes horizontally or vertically, and support mouse actions.

Compared to top, Htop has the following advantages:

    • You can scroll through the list of processes horizontally or vertically to see all the processes and the complete command line.

    • On startup, it's faster than top.

    • Process number is not required to kill the process.

    • Htop supports mouse operation.

    • Top is already very old.

Htop Official website: http://htop.sourceforge.net/

Second, htop installation

A. Source Package installation

# tar ZXVF htop-1.0.2.tar.gz

# CD htop-1.0.2

#./configure

650) this.width=650; "Width=" 427 "height=" title= "1" style= "border-width:0px;padding-top:0px;padding-right:0px"; Padding-left:0px;background-image:none, "alt=" 1 "src=" http://images.cnitblog.com/blog/370046/201301/ 12224043-6b33e911374542d18bb032c714f41875.jpg "border=" 0 "/>

# Make && make install

650) this.width=650; "Width=" 717 "height=" "title=" 2 "style=" border-width:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" 2 "src=" http://images.cnitblog.com/blog/370046/201301/12224046- C06690876fe9469fa9d3047b7e56f4d0.jpg "border=" 0 "/>

If an error occurs:

Configure:error:You may want to use--disable-unicode or install LIBNCURSESW.

You need to install Ncurses-devel

# yum Install Ncurses-devel

B. Rhel/centos Installation

You can install it via the Yum install Htop, but only if you want to add the Epel yum source, please refer to the configuration and use of the CentOS yum source.

# RPM-IVH http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
# RPM--import/etc/pki/rpm-gpg/rpm-gpg-key-epel//import KEY
# yum Install Htop

Three, htop parameters

Type the htop command to open htop.

# Htop

650) this.width=650; "Width=" "height=" 464 "title=" 3 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" 3 "src=" http://images.cnitblog.com/blog/370046/201301/12224048- E798f9f6de94490885989b39970a8270.jpg "border=" 0 "/>

Above the upper left corner shows the CPU, memory, swap area usage, the right display task, load, boot time, the following is the process real-time status.

The following is the function of F1~F10 and the corresponding letter shortcut keys.

Shortcut Key Function Key Description Chinese description
H? F1 Invoke Htop Help View Htop Usage Instructions
S F2 Htop Setup Menu Htop settings
/ F3 Search for a Process Search process
\ F4 Incremental Process Filtering Incremental process Filter
T F5 Tree View Show tree structure
<, > F6 Sort by a column Select the Sort method
[ F7 Nice-(change priority) The nice value can be reduced so that the priority of the corresponding process can be increased
] F8 Nice + (change priority) You can increase the nice value so that you can lower the priority of the corresponding process
K F9 Kill a Process Signals can be passed to the process
Q F10 Quit Htop End Htop

Command-line option (Command-Line options)

-C--no-color using a monochrome color scheme

-D--delay=delay Setting delay update time in seconds

-H--help Display htop command Help information

-U--user=username only shows a procedure for a given user

-P--pid=pid,pid ... Show only the given PIDs

-S--sort-key column to sort by

-v–version displaying version information

Interactive commands (INTERACTIVE COMMANDS)

Up or down key or pgup, PgDn Select the desired process, the left or right key or Home, End Mobile field, of course, can also be directly selected process with the mouse;

Space Mark/Unmark a process. Commands can be used for multiple processes, such as "kill", to be applied to all flagged processes

U Unmark All Processes

s Select a process, press S: System call to trace a process with strace

l Show files opened by the process: if Lsof is installed, press this key to display the files opened by the process

I Reverse the sort order, and if the sort is positive, it reverses in reverse and vice versa

+, - When in tree view mode, expand or collapse subtree. When a subtree was collapsed a "+" sign shows to the left of the process name.

A (on a multiprocessor machine) set CPU affinity: Flag which CPUs a process is allowed to use

u Show specific user processes

M Sort by memory use

P Sort by CPU usage

T use Sort by time+

F Trace process: If the sort order causes the selected process to move around the list, let the selected bar follow the process. This is useful for monitoring a process: In this way, you can keep a process visible on the screen. Using the arrow keys will stop the function.

K Show/Hide Kernel threads

H Show/Hide User threads

ctrl-l Refresh

Numbers PID lookup: Input PID, the cursor will be moved to the corresponding process

Iv. Use of Htop

4.1. Show your own Help

Mouse click Help or press F1 to show your own

650) this.width=650; "Width=" "height=" 465 "title=" 4 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" 4 "src=" http://images.cnitblog.com/blog/370046/201301/ 12224050-75be8605449248f999bde75c6697522f.jpg "border=" 0 "/>

4.2. Htop Settings

Mouse click Setup or press F2 after entering the Htop Settings page, Meters page set the top of some information display, the top of the display is divided into the left and right sides, in the end can show what can be added to the rightmost column, to add to the upper left (F5) or the right (F6) can be, This is the scope of personal settings. Add a clock here.

650) this.width=650; "Width=" "height=" 465 "title=" 8 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" 8 "src=" http://images.cnitblog.com/blog/370046/201301/ 12224052-570be85130854977aa4bc9f796fb0eb1.jpg "border=" 0 "/>

Above the left and right two columns of the display mode is divided into text bar Graph Led Four, I will change the CPU memory swap to text mode display, and then change to the bar display, clock with Led mode display. The data show is similar, just look a bit unaccustomed.

650) this.width=650; "Width=" "height=" 465 "title=" 9 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" 9 "src=" http://images.cnitblog.com/blog/370046/201301/12224053- Eca0d56c388240e495c0b3226ed45472.jpg "border=" 0 "/>

The settings for display options can be set according to the manager's own needs.

650) this.width=650; "Width=" "height=" 465 "title=" "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=", "src=" http://images.cnitblog.com/blog/370046/201301/ 12224054-97538b88011d4b6fb49e7d48ec7b4263.jpg "border=" 0 "/>

Color selection, in addition to the basic color display, Htop also provides the function of changing the panel, in fact, just change some color display settings, although said can not be customized to the details of the color display, but at least provide several styles can be selected.

650) this.width=650; "Width=" "height=" 465 "title=" one "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=", "src=" http://images.cnitblog.com/blog/370046/201301/ 12224056-2f6114304f37492095545a4ad6a68986.jpg "border=" 0 "/>

The last item is to adjust the display of the Columns, that is, in the general htop instructions in order to see what kind of data and information, the adjustment of the field can be done on this side of the personalized settings, generally use the system default value is good.

650) this.width=650; "Width=" "height=" 465 "title=" "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=", "src=" http://images.cnitblog.com/blog/370046/201301/12224059- A5ece1fdc31e420da897d01167e97550.jpg "border=" 0 "/>

4.3. Search process

Mouse click Search or press F3 or enter "/" to enter the process name for searching, such as search SSH

650) this.width=650; "Width=" "height=" 465 "title=" 5 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" 5 "src=" http://images.cnitblog.com/blog/370046/201301/12224101- Da92613d580148e7a74b5bde960bbbb8.jpg "border=" 0 "/>

4.4. Filter

Press F4, enter filter, equivalent to keyword search, not case sensitive, e.g. filter dev

650) this.width=650; "Width=" "height=" 465 "title=" "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=", "src=" http://images.cnitblog.com/blog/370046/201301/12224103- Ee01abbe5a7d4f5388057a52bd52e109.jpg "border=" 0 "/>

4.5. Show tree structure

Enter "T" or press F5, show the tree structure, meaning with pstree almost, can see all the program tree execution structure, which is very convenient for system management, how to clarify the procedure is generated, of course, the tree structure of the browsing can also be sorted according to other data.

650) this.width=650; "Width=" "height=" 465 "title=" 6 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" 6 "src=" http://images.cnitblog.com/blog/370046/201301/ 12224105-44b98e747b494234929f8af4e3eeb5e4.jpg "border=" 0 "/>

4.6. Select the Sort method

Press F6 to choose what to sort by, the most commonly ordered content is CPU and memory bar!

650) this.width=650; "Width=" "height=" 465 "title=" "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=", "src=" http://images.cnitblog.com/blog/370046/201301/ 12224111-2f34d96612bd420ebcf9471c7339fc63.jpg "border=" 0 "/>

4.7 Operation Process

F7, F8 respectively corresponding to nice-and nice+,f9 corresponding kill to process signal, choose the signal return is OK

650) this.width=650; "Width=" "height=" 465 "title=" "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=", "src=" http://images.cnitblog.com/blog/370046/201301/ 12224113-0e383c20b0e74196a393586b72a67ba1.jpg "border=" 0 "/>

4.8. Display a user's process, select the user on the left

Enter "U" and select User on the left

650) this.width=650; "Width=" "height=" 465 "title=" 7 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" 7 "src=" http://images.cnitblog.com/blog/370046/201301/ 12224116-5b7ca92b8c644464a65a11204e346f49.jpg "border=" 0 "/>

Five, Alias top

Perhaps you are used to top, we can also use top to open the htop.

Edit the/ROOT/.BASHRC file and add the following code

if [-f/usr/local/bin/htop]; Then alias top= '/usr/local/bin/htop ' fi

# SOURCE/ROOT/.BASHRC


This article is from the "Shiningliliang" blog, make sure to keep this source http://shiningliliang.blog.51cto.com/4984800/1426886

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.