htop

Interactive Process Viewer (Enhanced Top)

What Does It Do?

The htop command is like top on steroids—it's an enhanced, colorful, interactive process viewer that makes monitoring your Linux system much easier and more intuitive.

Unlike the basic top command, htop features full-color visual bars for CPU and memory, mouse support for clicking and scrolling, tree view to see process hierarchies, easier process killing (no need to remember PIDs), horizontal and vertical scrolling, and function keys for common actions. It's the go-to tool for system administrators who want a better real-time monitoring experience. Think of it as the difference between Notepad and a modern code editor—same purpose, but htop is way more user-friendly and powerful.

Advertisement

[ Insert Google AdSense Banner Code Here ]

When Should I Use It?

Daily System Monitoring

Use htop instead of top for everyday server health checks.

Finding Process Relationships

Tree view (F5) shows which processes spawned others.

Multi-User Servers

Easily filter and view processes by different users with color coding.

Quick Resource Checks

Visual bars show CPU/memory at a glance—no math needed.

Common Commands & Keys

htop

Start the interactive process viewer with full colors and mouse support.

htop -u username

Show processes only for a specific user (replace "username" with: root, mysql, www-data, postgres, or user).

htop -p 789

Monitor specific process ID (PID 1234).

htop --sort-key PERCENT_CPU

Start sorted by CPU usage (default behavior).

htop --sort-key PERCENT_MEM

Start sorted by memory usage instead of CPU.

Interactive Function Keys (while htop is running):

F1 / h Show help screen
F2 / S Setup / configure htop
F3 / / Search for a process
F4 / \ Filter processes by name
F5 / t Tree view (show process hierarchy)
F6 Sort by column (CPU, MEM, TIME, etc.)
F7 / ] Increase process priority (nice)
F8 / [ Decrease process priority (nice)
F9 / k Kill selected process
F10 / q Quit htop
Space Tag/untag process
u Show processes of specific user
M Sort by memory usage
P Sort by CPU usage
T Sort by running time
c Show full command paths

PRO TIPS

Installation Required: Unlike top, htop needs to be installed first. On Ubuntu/Debian: sudo apt install htop, CentOS/RHEL: sudo yum install htop, Arch: sudo pacman -S htop

Simulator Password: When testing installation commands in the simulator below, use password: admin123

Use Your Mouse: Unlike top, you can click on column headers to sort, click processes to select them, and scroll with your mouse wheel!

Tree View is Powerful: Press F5 to see which processes started others. Great for finding parent processes causing issues.

Search is Your Friend: Press F3 or / to search for processes by name instead of scrolling.

Create an Alias: Add alias top='htop' to your .bashrc so typing "top" runs htop instead!

Try It Yourself

Experience the colorful htop interface below. Notice the visual differences from top—colorful bars, function key shortcuts, and better layout: