CentOS / RHEL: Install htop An Interactive Text-mode Process Viewer

Posted on in Categories , , , last updated December 17, 2013

I am a new Linux/CentOS/RHEL sysadmin. How do I install an interactive text-mode process viewer for called htop on CentOS or Red Hat Enterprise Linux 5.x/6.x+ based system using yum 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.

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
Sample outputs:

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
 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 
  htop.x86_64 0:1.0.1-2.el6                                                                 

How do I use htop program?

Type the following command as root user. The basic syntax is:
# htop
# htop [options]

Sample outputs:

Fig.01: htop in action
Fig.01: htop in action

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

See htop(1) for more information.

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

Leave a Comment