A process management tool that replaces top under Linux htop

Source: Internet
Author: User
Tags gpg cpu usage

Tag: While text post system calls ble amp lease. NET System

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

# Make && make install

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

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

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.

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.

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

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.

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.

4.3. Search process

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

4.4. Filter

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

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.

4.6. Select the Sort method

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

4.7 Operation Process

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

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

Enter "U" and select User on the left

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

Category: Linux Tags: Linux stunts, process management tools, Htop come from:http://www.cnblogs.com/mchina/archive/2013/03/15/2858041.html#undefined

A process management tool that replaces top under Linux htop

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.