System and processes
The htop command
Interactive process monitor with CPU and memory bars. More visual than top.
Most useful options
-u, --user USUARIOShows only the processes of that user, by name or UID. Without a value, shows yours-p, --pid PID,PID...Shows only the processes with those PIDs-d, --delay DÉCIMASInterval between updates, in tenths of a second. Below 1 it is raised to 1-s, --sort-key COLUMNASorts by that column. With --sort-key help the available ones are listed-t, --treeShows processes as a tree of parents and children--readonlyDisables the features that change the system or processes. Good for looking without touchingCopy-ready examples
$ htop -u rootonly root's processes.$ htop -p 1only the process with PID 1, the first one the system starts.$ htop -d 50updates every five seconds, because the value is in tenths.$ htop --readonly -ttree view with no way to change anything from the screen.$ htop --readonly -u "$USER"looks at your processes without modifying any.You can try them in the browser terminal: it does not touch your computer.
Common errors
| Message | Cause | Fix |
|---|---|---|
| Error: invalid user "nosuchuser". | With -u, the name does not exist on the system and is not a numeric UID either. | Check the name with id name, or use the numeric UID. |
| Error: invalid delay value "abc". | The -d value must be a number of tenths, and abc is not one. | Pass a number: -d 15 refreshes every 1.5 seconds. |
Typical mistakes
- htop is not installed on every distribution. On Debian or Ubuntu, install it with sudo apt install htop.
- Inside htop, F9 (or k) sends a signal to the selected process. Think twice before killing a system process.
- Function keys may not respond in some terminals. Help is on F1 or h, and quitting is on F10 or q.
Differences from similar commands
- top: is installed on almost every system and needs nothing extra. htop has bars, colours and menus, but it has to be installed.
- ps: gives an instant snapshot of the processes and exits. htop updates itself and lets you filter and sort live.
- kill: sends a signal to a process from the command line. htop does the same from its menu with F9.
FAQ
top or htop?
htop is more comfortable to watch and act with. top is almost always installed and needs nothing extra.
How do I search for a process inside htop?
Press F3 or /, then type the text. htop searches the command lines of the processes as you type.
How do I quit htop?
With F10 or q.
Learn to actually use it
The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.
Start the free course