htopInteractive process viewer with bars and a tree
htop is a friendlier top: per-core CPU bars, a memory bar, scrolling, a process tree, search and filter, and killing or renicing with function keys. It is not always installed on servers, but when it is, it is the fastest way to explore a busy box.
htop [-u USER] [-p PID,...] [-t] [-d TENTHS] [-s COLUMN]CPU alerts fired on a 4-core box. Get a picture of every core and of memory in one screen.
htopThe ncurses process viewer. Install with apt install htop or dnf install htop.
Like top, htop reads /proc on every refresh (/proc/stat for CPU ticks, /proc/meminfo, and /proc/PID/stat, statm, status and cmdline per process) and computes rates from the difference between samples. It draws with ncurses, so it needs a real terminal; it has no batch mode. Kernel threads are hidden by default and user threads are shown as separate rows (shown in a different colour) unless you hide them with H. Its memory bar is built from /proc/meminfo: green is memory used by processes, blue buffers, yellow/orange page cache. Actions like F9 (kill) and F7/F8 (nice) are plain kill() and setpriority() system calls, with the same permission rules as kill and renice. Settings you change in F2 are saved to ~/.config/htop/htoprc.
-u USERShow only USER's processes-p PID,...Show only these PIDs-tTree view (F5 toggles)-d TENTHSRefresh delay in tenths of a second (-d 10 = 1 s)-s COLUMNSort by a column, e.g. -s PERCENT_MEM-HHighlight new and old processesF3 or /Search for a process by nameF4 or \Filter: show only matching processesF6 or < >Choose the sort columnF9 or kSend a signal (default SIGTERM) to the selected processSpace / UTag processes / untag all, so F9 acts on all taggedH / KHide user threads / kernel threadshtop -d 2 expecting a 2-second refreshhtop's delay is in tenths of a second, so -d 2 refreshes every 0.2 s and burns CPU on a busy box.
htop -d 20Counting the same process three times because it shows three rowsBy default htop lists user threads as separate rows with the same command; RES and VIRT are per process, not per thread.
Press H to hide user threads, or use tree viewhtop > snapshot.txt in a scripthtop is interactive only and writes screen control codes; there is no batch mode.
top -b -n 1 > snapshot.txt or ps aux --sort=-%cpuReading the full Mem bar as 'memory is full'The bar includes buffers and page cache, which the kernel gives back when needed. The number after it counts used memory only.
Read the 3.87G/7.67G figure, or free -h's available columnTry these on a Linux machine of your own. Each task has a hint and a solution.
Start htop showing only your own processes, refreshing every second.
Open htop in tree view and find your shell and htop itself.
Start `sleep 600 &`, then in htop filter for 'sleep' and send it SIGTERM.
htopInteractive process viewer with bars and a tree
htop is a friendlier top: per-core CPU bars, a memory bar, scrolling, a process tree, search and filter, and killing or renicing with function keys. It is not always installed on servers, but when it is, it is the fastest way to explore a busy box.
htop [-u USER] [-p PID,...] [-t] [-d TENTHS] [-s COLUMN]CPU alerts fired on a 4-core box. Get a picture of every core and of memory in one screen.
htopThe ncurses process viewer. Install with apt install htop or dnf install htop.
Like top, htop reads /proc on every refresh (/proc/stat for CPU ticks, /proc/meminfo, and /proc/PID/stat, statm, status and cmdline per process) and computes rates from the difference between samples. It draws with ncurses, so it needs a real terminal; it has no batch mode. Kernel threads are hidden by default and user threads are shown as separate rows (shown in a different colour) unless you hide them with H. Its memory bar is built from /proc/meminfo: green is memory used by processes, blue buffers, yellow/orange page cache. Actions like F9 (kill) and F7/F8 (nice) are plain kill() and setpriority() system calls, with the same permission rules as kill and renice. Settings you change in F2 are saved to ~/.config/htop/htoprc.
-u USERShow only USER's processes-p PID,...Show only these PIDs-tTree view (F5 toggles)-d TENTHSRefresh delay in tenths of a second (-d 10 = 1 s)-s COLUMNSort by a column, e.g. -s PERCENT_MEM-HHighlight new and old processesF3 or /Search for a process by nameF4 or \Filter: show only matching processesF6 or < >Choose the sort columnF9 or kSend a signal (default SIGTERM) to the selected processSpace / UTag processes / untag all, so F9 acts on all taggedH / KHide user threads / kernel threadshtop -d 2 expecting a 2-second refreshhtop's delay is in tenths of a second, so -d 2 refreshes every 0.2 s and burns CPU on a busy box.
htop -d 20Counting the same process three times because it shows three rowsBy default htop lists user threads as separate rows with the same command; RES and VIRT are per process, not per thread.
Press H to hide user threads, or use tree viewhtop > snapshot.txt in a scripthtop is interactive only and writes screen control codes; there is no batch mode.
top -b -n 1 > snapshot.txt or ps aux --sort=-%cpuReading the full Mem bar as 'memory is full'The bar includes buffers and page cache, which the kernel gives back when needed. The number after it counts used memory only.
Read the 3.87G/7.67G figure, or free -h's available columnTry these on a Linux machine of your own. Each task has a hint and a solution.
Start htop showing only your own processes, refreshing every second.
Open htop in tree view and find your shell and htop itself.
Start `sleep 600 &`, then in htop filter for 'sleep' and send it SIGTERM.