htop Tool in Linux - htop command explained with examples

The htop command in Linux is used to monitor the activity of critical system resources or server processes in real-time. The htop command is newer than the top command, it allows mouse manipulation, has colors in the output and provides visual instructions for processor, memory, and swap usage.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Linux system commands queries.

In this context, we shall look into how to use the htop tool in Linux. 


What Htop command can do:

  • Htop lets you scroll the list vertically and horizontally to view all processes and entire command lines.
  • Htop starts faster compared with top command, seems that top collect data for a while before displaying anything.
  • The specified process can be killed without inputting the process ID.
  • You can renice a process without entering the process ID or priority value.
  • You can kill multiple processes at once.
  • The Htop command comes with a color output.


How to install htop ?

1. For Fedora system, use DNF Command to install htop:

$ sudo dnf install htop

2. For Debian/Ubuntu systems, use APT-GET Command or APT Command to install htop:

$ sudo apt install htop

3. For Arch Linux based systems, use Pacman Command to install htop.

$ sudo pacman -S htop

4. For RHEL/CentOS systems, use YUM Command to install htop:

$ sudo yum install htop

5. For openSUSE Leap system, use Zypper Command to install htop:

$ sudo zypper install htop


What is the syntax of htop command ?

It's syntax is given below:

$ htop

To quit the htop windows, Press F10.


htop command Options

1. -C: show table without color:

$ htop -C

2. -t: display tree view:

$ htop -t

3. -h: display help message:

$ htop -h

4. -v: check your version:

$ htop -v

5. Interactive buttons

  • F1 - Help
  • F2 - Setup
  • F3 - Search
  • F4 - Filter
  • F5 - Tree
  • F6 - SortBy
  • F7 - Nice -
  • F8 - Nice +
  • F9 - Kill
  • F10 - Quit


Understanding the Htop Command Output

The Htop command output can be considered of three parts (header, body and footer). The details of each part release are described below;

  • Header: The header section shows the CPU usage, memory usage, swap usage, load average, and system uptime. This area is highly configurable based on your needs.
  • Body: The body displays a list of processes currently running on your system.
  • Footer: The footer area has the htop menu option, which allows you to perform various actions immediately.


[Need help in fixing Linux System issues ? We can help you. ]

This article covers how to use the htop tool in Linux. In fact, the htop command is an interactive process viewer for Linux / Unix systems. It is a text-mode application and requires the ncurses library.


How to Install and Use Htop in Linux System ?

To install Htop on a Linux operating system distribution of your choice, reference one of the following installation commands:

$ sudo apt-get install htop     [On Debian, Ubuntu and Mint]
$ sudo yum install htop         [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux]
$ sudo emerge sys-process/htop  [On Gentoo Linux]
$ sudo pacman -S htop           [On Arch Linux]
$ sudo zypper install htop      [On OpenSUSE]  

Related Posts