htop is nothing but Interactive process viewer for CentOS/RHEL based servers and desktop systems. It is just like default top command with an additional set of options and better display on the screen. This page shows how to install htop on CentOS/RHEL using yum command line options.
CentOS / RHEL Install htop command
You can install htop on CentOS/RHEL/Fedora Linux using EPEL repo. From the man page:
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.
The procedure for installing htop on CentOS/RHEL is as follows:
- Open the terminal window.
- For remote CentOS/RHEL server login using ssh command.
- Execute yum search htop command to search for htop on CentOS/RHEL
- Run sudo yum install htop to install htop in CentOS/RHEL
Let us see all commands and examples.
Install htop on CentOS/RHEL/Red hat Linux using yum
First you need to enable EPEL repo as described here to install atop. Type the following yum command:
# yum install htop
Loaded plugins: auto-update-debuginfo, protectbase, rhnplugin, security This system is receiving updates from RHN Classic or RHN Satellite. 0 packages excluded due to repository protections Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package htop.x86_64 0:1.0.1-2.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================ Package Arch Version Repository Size ============================================================================================ Installing: htop x86_64 1.0.1-2.el6 epel 75 k Transaction Summary ============================================================================================ Install 1 Package(s) Total download size: 75 k Installed size: 161 k Is this ok [y/N]: y Downloading Packages: htop-1.0.1-2.el6.x86_64.rpm | 75 kB 00:00 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : htop-1.0.1-2.el6.x86_64 1/1 Verifying : htop-1.0.1-2.el6.x86_64 1/1 Installed: htop.x86_64 0:1.0.1-2.el6 Complete!
How do I use htop program?
Type the following command as root user. The basic syntax is:
# htop [options]
htop command examples
Here are some conman and useful examples of htop commands:
Delay between data updates, in tenths of seconds
# htop -d 5
# htop --delay=10
How to start htop in monochrome mode i.e. disable colors
# htop -C
# htop --no-color
# htop --no-colour
Show only the process of a given user (say nixcraft or apache user)
# htop -u nixcraft
# htop --user=apache
Display working thread for pagemap memory stats
# htop -p
CentOS/RHEL htop keyboard shortcut keys
The following commands are supported while in htop:
|Up arrow key||Select (highlight) the previous process in the process list. Scroll the list if necessary.|
|Down arrow key||Select (highlight) the next process in the process list. Scroll the list if necessary.|
|Left arrow key||Scroll the process list left.|
|Right arrow key||Scroll the process list right.|
|PgUp, PgDn||Scroll the process list up or down one window.|
|Home||Scroll to the top of the process list and select the first process.|
|End||Scroll to the bottom of the process list and select the last process.|
|s||Trace process system calls: if strace(1) is installed, pressing this key will attach it to the currently selected process, presenting a live update of system calls issued by the process.|
|l||Display open files for a process: if lsof(1) is installed, pressing this key will display the list of file descriptors opened by the process.|
Other keyboard shortcuts
|u||Show only processes owned by a specified user.|
|M||Sort by memory usage (top compatibility key).|
|P||Sort by processor usage (top compatibility key).|
|T||Sort by time (top compatibility key).|
|F||“Follow” process: if the sort order causes the currently selected process to move in the list, make the selection bar follow it. This is useful for monitoring a process: this way, you can keep a process always visible on screen. When a movement key is used, “follow” loses effect.|
|K||Hide kernel threads: prevent the threads belonging the kernel to be displayed in the process list. (This is a toggle key.)|
|H||Hide user threads: on systems that represent them differently than ordinary processes (such as recent NPTL-based systems), this can hide threads from userspace processes in the process list. (This is a toggle key.)|
|p||Show full paths to running programs, where applicable. (This is a toggle key.)|
|Ctrl-L||Rfresh the screen.|
|F1||See this help menu.|
This page showed you how to install and use htop on CentOS/RHEL based Linux server. It has many more option. Hence, see the htop home page online here or read htop(1) command man page for more information.