htop – Interactive Process Viewer and System Monitor
Complete Guide to htop: Advanced System Monitoring for Linux and Beyond
htop stands as one of the most essential tools in any Linux user’s arsenal, providing an interactive, real-time view of system processes, resource utilization, and performance metrics. As an enhanced alternative to the traditional top command, htop offers a colorful, intuitive interface that transforms system monitoring from a cryptic text display into an accessible and powerful diagnostic experience. Available across Linux, macOS, FreeBSD, and other Unix-like systems, htop has become synonymous with effective command-line system management.
The visual presentation of htop makes complex system information immediately comprehensible. CPU cores display as individually colored bars, memory and swap usage appear as intuitive meters, and the process list presents sortable, searchable information about every running process. Mouse support, tree view for process hierarchies, and the ability to send signals directly to processes without leaving the interface make htop an indispensable tool for system administrators, developers, and power users alike.
Key Features and Improvements Over top
While top provides fundamental process monitoring, htop enhances the experience in numerous ways. The interface updates in real-time without requiring manual refresh commands. Scrolling through the process list works intuitively, both vertically through processes and horizontally to reveal additional columns. Color-coded output distinguishes between user processes, system processes, and various resource states.
Process management becomes straightforward with htop. You can select multiple processes using space bar, then apply actions to all selected processes simultaneously. Killing processes, renicing priorities, and sending arbitrary signals happen without leaving the interface or memorizing process IDs. The search function filters processes instantly as you type, making it trivial to locate specific processes among hundreds of entries.
The tree view option reveals parent-child relationships between processes, showing how processes spawn from one another. This visualization proves invaluable when debugging runaway processes or understanding system behavior. Collapsing and expanding tree branches allows focusing on relevant process groups while hiding unrelated ones.
Installing htop
htop is available in the standard repositories of virtually every Linux distribution and can be installed on macOS via Homebrew.
Linux Installation
# Ubuntu/Debian
sudo apt update
sudo apt install htop
# Fedora
sudo dnf install htop
# Arch Linux
sudo pacman -S htop
# CentOS/RHEL (EPEL required)
sudo yum install epel-release
sudo yum install htop
# openSUSE
sudo zypper install htop
# Gentoo
sudo emerge -av sys-process/htop
# Alpine
sudo apk add htop
# Flatpak
flatpak install flathub org.freedesktop.Platform.Compat.htop
# Build from source
git clone https://github.com/htop-dev/htop.git
cd htop
./autogen.sh && ./configure && make
sudo make install
# Verify installation
htop --version
macOS Installation
# Homebrew
brew install htop
# MacPorts
sudo port install htop
# Verify
htop --version
Windows (via WSL)
# In WSL Ubuntu
sudo apt update
sudo apt install htop
# Run htop
htop
Understanding the htop Interface
The htop display divides into three main sections: header meters showing system resources, the process list occupying most of the screen, and a function key legend at the bottom.
# Header section components:
# CPU bars (one per core/thread)
# |||||||||||||||--------- 45.2%
# Green: normal user processes
# Blue: low priority processes
# Red: kernel processes
# Cyan: virtualization
# Gray: I/O wait
# Memory bar
# [|||||||||||||------------- 8.56G/16.0G]
# Green: used memory
# Blue: buffers
# Orange: cache
# Swap bar
# [|--------- 0.21G/4.00G]
# Load average: 1.25 0.98 0.85
# Tasks: 245, 892 thr; 2 running
# Uptime: 5 days, 12:34:56
Navigating and Using htop
htop responds to both keyboard shortcuts and mouse input, making navigation intuitive regardless of your preference.
# Basic Navigation
Arrow keys Navigate process list
Page Up/Down Scroll by page
Home/End Jump to beginning/end
h Show help screen
q Quit htop
# Process Selection
Space Tag/untag process
U Untag all processes
c Tag process and children
# Sorting
F6 or > Choose sort column
M Sort by memory usage
P Sort by CPU usage
T Sort by time
I Invert sort order
# Searching and Filtering
F3 or / Search by name
F4 or \\ Filter by name
Esc Clear search/filter
# Process Actions
F9 or k Kill process (select signal)
+ or - Expand/collapse tree branches
l List open files (lsof)
s Trace system calls (strace)
# Display Options
F5 or t Toggle tree view
H Hide/show user threads
K Hide/show kernel threads
F2 or S Enter setup menu
# Process Priority
F7 Increase priority (nice -)
F8 Decrease priority (nice +)
Column Information and Metrics
Understanding what each column displays enables effective process analysis.
# Default columns explained:
# PID - Process ID
# USER - Process owner username
# PRI - Priority (kernel scheduling priority)
# NI - Nice value (-20 to 19, lower = higher priority)
# VIRT - Virtual memory size
# RES - Resident memory (actual RAM used)
# SHR - Shared memory
# S - Process state:
# R = Running
# S = Sleeping
# D = Disk sleep (uninterruptible)
# Z = Zombie
# T = Stopped
# I = Idle
# CPU% - Percentage of CPU time
# MEM% - Percentage of physical memory
# TIME+ - Cumulative CPU time
# Command - Command line that started the process
# Additional columns available:
# PPID - Parent PID
# PGRP - Process group ID
# SESSION - Session ID
# TTY - Controlling terminal
# TPGID - Foreground process group
# NLWP - Number of threads
# IO_READ/WRITE - I/O statistics
# CTXT - Context switches
Configuration and Customization
htop stores configuration in ~/.config/htop/htoprc, which can be edited directly or configured through the setup menu (F2).
# Access setup menu
F2 (or S)
# Setup sections:
# 1. Meters - Configure header display
# 2. Display options - Visual preferences
# 3. Colors - Color scheme selection
# 4. Columns - Choose visible columns
# Meters configuration:
# Left and right columns in header
# Available meters:
# - CPU (aggregate or per-core)
# - Memory
# - Swap
# - Tasks
# - Load average
# - Uptime
# - Hostname
# - Clock
# - Battery
# - Disk I/O
# - Network I/O
# Display options:
# - Tree view (default off)
# - Shadow other users' processes
# - Hide kernel threads
# - Hide userland threads
# - Show program path
# - Highlight program basename
# - Merge cpu/exe/comm columns
# - Update interval (default 1.5s)
# Sample htoprc configuration
# ~/.config/htop/htoprc
fields=0 48 17 18 38 39 40 2 46 47 49 1
sort_key=46
sort_direction=1
tree_sort_key=0
tree_sort_direction=1
hide_kernel_threads=1
hide_userland_threads=0
shadow_other_users=0
show_thread_names=0
show_program_path=1
highlight_base_name=1
highlight_megabytes=1
highlight_threads=1
tree_view=0
header_margin=1
detailed_cpu_time=0
cpu_count_from_zero=0
update_process_names=0
account_guest_in_cpu_meter=0
color_scheme=0
delay=15
left_meters=AllCPUs Memory Swap
left_meter_modes=1 1 1
right_meters=Tasks LoadAverage Uptime
right_meter_modes=2 2 2
Process Management Actions
htop enables comprehensive process management directly from its interface.
# Killing processes
F9 Open kill menu
Select signal:
1 SIGHUP Hangup
2 SIGINT Interrupt (Ctrl+C)
3 SIGQUIT Quit
9 SIGKILL Kill (cannot be caught)
15 SIGTERM Terminate (graceful)
18 SIGCONT Continue
19 SIGSTOP Stop
# Kill multiple processes
Space Select first process
Arrow + Space Select additional processes
F9 Send signal to all selected
# Renice processes (change priority)
F7 Increase priority (lower nice)
F8 Decrease priority (higher nice)
# Note: Lowering nice value requires root
# Trace process activities
s Attach strace to process
l List open files with lsof
# Process environment
e Show environment variables
# Example: Kill all processes by user
F4 Filter by username
Space Select processes
F9 > 9 Send SIGKILL
Advanced Usage Scenarios
htop serves effectively in various system administration and debugging scenarios.
# Monitor specific user's processes
htop -u username
# Monitor specific process
htop -p 1234,5678
# Start in tree view
htop -t
# Delay between updates (tenths of seconds)
htop -d 10 # 1 second delay
# Monochrome mode (for logging)
htop -C
# Show only processes matching command
htop -F command_name
# Batch mode (non-interactive, for scripting)
htop -b
# Output one iteration and exit (like ps)
htop -b -n 1
# Monitor CPU-intensive processes
# Press P to sort by CPU
# Press F5 for tree view to find parent
# Find memory hogs
# Press M to sort by memory
# Look at RES (resident) column
# Identify zombie processes
# Press F4, filter for 'Z' state
# Find parent process and investigate
# Monitor I/O wait
# Look at CPU bars for red (I/O wait)
# Enable DISK I/O column in setup
Comparing htop with Alternatives
Understanding how htop compares with similar tools helps choose the right one for each situation.
# top - Original Unix process viewer
# Pros: Available everywhere, minimal dependencies
# Cons: Less intuitive interface, limited features
# glances - More comprehensive system monitoring
# Pros: More metrics (network, disk, sensors)
# Cons: Heavier, requires Python
# btop - Modern, resource-rich alternative
# Pros: Beautiful graphs, network/disk/GPU monitoring
# Cons: Newer, less widespread
# atop - Detailed performance analysis
# Pros: Historical data, comprehensive metrics
# Cons: Steeper learning curve
# nmon - AIX-style interactive monitor
# Pros: Toggleable sections, good for servers
# Cons: Different interface paradigm
# Example: When to use each
# Quick process check: htop
# Detailed debugging: htop or atop
# System overview: btop or glances
# Remote minimal systems: top
# Performance recording: atop
htop in System Administration
System administrators rely on htop for daily monitoring and troubleshooting tasks.
# Common sysadmin workflows:
# 1. Diagnose high CPU usage
htop
# Press P to sort by CPU
# Identify top consumers
# Press t for tree view to find parent processes
# Use l to check open files
# Use s to trace system calls
# 2. Track memory consumption
htop
# Press M to sort by memory
# Check RES column for actual RAM usage
# Press H to hide threads if needed
# Look for processes with growing memory
# 3. Handle runaway processes
htop
# F4 to filter by process name
# Space to select matching processes
# F9 > 15 (SIGTERM) for graceful stop
# If unresponsive, F9 > 9 (SIGKILL)
# 4. Monitor during deployment
htop -d 5 -u appuser
# Watch application processes
# Monitor resource usage during startup
# 5. Investigate zombie processes
htop
# F4, search for Z state
# Note PPID of zombies
# Find and restart parent process
# 6. Check thread counts
htop
# Press H to show all threads
# Count threads per application
# Identify thread leaks
Environment Variables and Options
htop behavior can be customized through environment variables and command-line options.
# Environment variables
export HTOPRC=/path/to/custom/htoprc # Custom config location
# Command-line options
-C --no-color Monochrome mode
-d --delay=DELAY Update delay (tenths of seconds)
-F --filter=FILTER Show only matching commands
-h --help Print help
-H --highlight-changes Highlight new/changed processes
-M --no-mouse Disable mouse
-p --pid=PID Show only specific PIDs
-s --sort-key=KEY Sort by specified column
-t --tree Start in tree view mode
-u --user=USER Show only user's processes
-U --no-unicode Do not use Unicode
-V --version Print version
# Examples
htop --sort-key=PERCENT_MEM
htop --tree --user=www-data
htop --highlight-changes --delay=20
Tips and Tricks
Power users can leverage htop’s lesser-known features for enhanced productivity.
# Quickly find process ID
htop
# F3 search for process name
# PID shown in first column
# Save and load configs for different scenarios
cp ~/.config/htop/htoprc ~/.config/htop/htoprc.server
cp ~/.config/htop/htoprc ~/.config/htop/htoprc.development
# Edit as needed, copy back when switching
# Use with watch for specific monitoring
watch -n 1 'htop -b -n 1 | head -20'
# Combine with other tools
htop -p $(pgrep -d, nginx) # Monitor nginx processes
# Quick system summary
htop -b -n 1 | head -10
# Monitor container processes
htop -p $(docker top container_id -eo pid | tail -n +2 | tr '\n' ',' | sed 's/,$//')
# Color schemes
# F2 > Colors
# Available: default, monochromatic, black on white, light terminal, mc, black night, broken gray
Troubleshooting htop
Common issues and their solutions ensure htop works reliably.
# Permission denied for some processes
# Run as root to see all process details
sudo htop
# Display issues in terminal
# Try: export TERM=xterm-256color
# Or: export TERM=screen-256color
# Mouse not working
# Ensure terminal supports mouse
# Try: export TERM=xterm
# htoprc not loading
# Check file location
ls -la ~/.config/htop/htoprc
# Verify permissions
chmod 644 ~/.config/htop/htoprc
# High CPU usage by htop itself
# Increase delay: htop -d 30
# Disable color: htop -C
# Can't see all CPUs
# Check setup: F2 > Meters
# Ensure CPU type is set correctly
Conclusion
htop represents the gold standard for interactive process monitoring on Unix-like systems. Its combination of comprehensive information, intuitive interface, and powerful process management capabilities makes it indispensable for anyone who works with the command line. From casual monitoring to intensive debugging sessions, htop provides the tools needed to understand and manage system processes effectively. The active development community continues to refine and enhance the tool, ensuring htop remains relevant and capable as operating systems evolve.
Download Options
Download htop – Interactive Process Viewer and System Monitor
Version 3.3.0
File Size: 500 KB
Download NowSafe & Secure
Verified and scanned for viruses
Regular Updates
Always get the latest version
24/7 Support
Help available when you need it