Command line tools: htop

htop

The top command displays Linux processes, and one of the first packages I install on a new Linux setup is the enhanced, interactive htop viewer. Good-looking and easy to use: see CPU and MEMORY usage at a glance, system load and uptime, kill wonky processes, and more!

Install: On Ubuntu/Debian ...

$ sudo apt install htop lsof

Helpful Commands

To search for a specific process ID (PID) just input the number in the htop window and ENTER to select.

Menu function keys F1->F10 may conflict with desktop environment settings. Fortunately there are many keycode shortcuts, and these are the ones I find most useful ...

h
help menu
t
toggles the tree view which displays all related processes
l
show all files opened by a process (uses lsof)
u
select a user and display only processes belonging to that ID
/
search for process by keyword
\
filter processes by keyword
Shift + f
follow a process
Shift + .
sort menu, Shift + i will invert the sort
Shift + p
shortcut to sort processes by CPU ...
Shift + m
... by MEMORY ...
Shift + t
... or TIME
Space
toggle a tag (useful for selecting multiple processes to kill)
Shift + u
remove all tags
k
kill process menu
q
quit

Happy hacking!

More • shelltoolslinux