How To's Tutorials
htop is a interactive process viewer in UNIX like operating system.Htop is a free (GPL) ncurses-based process viewer for Linux.It is similar to top, but allows you to scroll vertically and horizontally, so you can see all the processes running on the system, along with their full command lines.Tasks related to processes (killing, renicing) can be done without entering their PIDs.
htop is designed to replace the UNIX top command . It shows a frequently updated list of the processes running on a computer, normally ordered by the amount of CPU usage. Htop uses color and gives visual information about processor, swap and memory status.
Installation of htop on Ubuntu :
# sudo apt-get install htop
Installation of htop on CentOS 6.X / RHEL 6.X
As htop package is not available in the default repositories , so first enable the epel repository and then use yum command to install htop.
# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
# yum install htop
# htop [-dChusv]
-d Delay between updates, in tenths of seconds
-C Start htop in monochrome mode
-h Display a help message and exit
-u –user=USERNAME ( Show only the processes of a given user)
-p Start working thread for pagemap memory stats
-s --sort-key COLUMN , Sort by this column (use --sort-key help for a column list)
-v --version (Output version information and exit)
Example:1 htop output consists of three sections :
Section 1 : Header shows the CPU usage , Memory usage & Swap usage along with Load average and uptime of linux box.
Section 2 : Body shows the list of processes sorted by %CPU usage.
Section 3 : Footer displays htop menu commands.
Example:2 Kill the process without leaving htop
To kill a process , first select the process and then press F9 or k and then click on send to kill the process , in my case i am killing the puppet process as shown below :
Example:3 Display the Process sorted by different options.
By default htop shows the process sorted by CPU usage , if you want change sorting option , then Press F6 and select your respective Options as shown below :
In my case i am selecting Memory based sorting .
Example:4 Shows the process of a Particular User
To display the process of a particular user , press “u” and select the user as shown below :
Exaple:5 Shows the Process Tree ( Press F5 or t)
Example:6 Display the htop Menu Setup (Press F2)
Backtick (`) symbol