We use cookies to understand how the site is used and to display ads. Analytics and advertising only run after you accept. You can change your choice anytime. Privacy policy

Skip to content
devvkit
$devvkit learn --librarie htop-&-btop-guide

htop & btop Guide

[monitoring][processes][cpu][memory]
System Monitoring
Install
sudo apt install htop btop
brew install htop btop
# Windows: btop via WSL or Process Explorer GUI

htop is the first thing you run on an unfamiliar server. Unlike `top`, it shows a color-coded tree view, mouse support, and lets you send signals (kill, renic) interactively. Press `F5` for tree mode, `F6` to sort by any column, and `F9` to kill a process.

btop is a modern alternative with GPU monitoring, disk I/O graphs, network throughput, and a much prettier TUI. It uses CPU, memory, and disk sensors out of the box. Both have customizable color themes.

Key htop tricks: press `u` to filter by user, `t` for tree view, `H` to hide/show user threads, `K` to hide kernel threads. Setup `F2` columns to show IO rate, disk writes, and swap usage. GUI alternatives: Process Explorer (Windows), Activity Monitor (macOS), GNOME System Monitor.

htop Basics

Start htop· Launch interactive monitor.
htop
htop -u www-data            # Only show www-data user
htop -p 1234,5678           # Only show these PIDs
htop -t                     # Start in tree mode
htop -C                     # Monochrome mode
htop keyboard shortcuts· Most useful keys.
# F5 / t : Tree view
# F6     : Sort by column
# F9     : Kill process (select signal)
# u      : Filter by user
# H      : Toggle user threads
# K      : Toggle kernel threads
# /      : Search process names
# Space  : Tag process for batch action
# F2     : Setup (columns, colors, meters)
htop tree mode· Parent-child process tree.
# Press F5 to toggle tree view
# See which process spawned which child
# Useful for: finding zombie processes, orphaned children

# Tree from CLI:
htop -t
# Or: ps auxf  (ps tree view in CLI only)

htop Filters

htop: sort by IO· Find disk hogs.
# In F2 Setup → Columns:
# Add "IO read rate" and "IO write rate" (requires lsof)
# Then F6 and select those columns

# Alternative: iotop:
sudo iotop -oP  # Only processes with I/O
htop: find CPU hogs· Processes eating CPU.
# Sort by CPU% (F6 then select PERCENT_CPU)
# Press P to sort by CPU instantly (shortcut)
# Press M to sort by memory instantly
# Press T to sort by TIME+ (cumulative CPU)

btop

btop launch· Launch btop.
btop
btop --utf-force            # Force UTF-8 (better box drawing)
btop --low-color            # Less color (terminal compatibility)

# Inside btop:
# Tab: switch between CPU, MEM, DISK, NET, PROC
# ?: help
# m: menu
# q: quit
btop GPU monitoring· Watch GPU usage.
# btop auto-detects NVIDIA GPUs (nvidia-smi required)
# Tab to PROC screen → GPU column shows utilization
# Or watch directly:
watch -n 1 nvidia-smi --query-gpu=utilization.gpu,memory.used --format=csv

# AMD GPUs: needs amdgpu module
# Intel GPUs: needs intel-gpu-tools

Customization

htop custom config· Persistent settings.
# Config file: ~/.config/htop/htoprc
# Or launch with:
htop -C                       # Start fresh (no config)

# Key settings to enable:
# tree_view=1
# sort_key=PERCENT_CPU
# hide_kernel_threads=1
# highlight_base_name=1
# detailed_cpu_time=1
# cpu_count_from_zero=0
btop themes· Change btop appearance.
# Themes in ~/.config/btop/themes/
# Download from: github.com/aristocratos/btop
# In btop: press m -> Options -> Theme

# Or set theme via env:
BTOP_THEME=nord btop
BTOP_THEME=dracula btop
BTOP_THEME=catppuccin btop