One of the first commands many system administrators learn is top
, which shows (amongst other things) which processes are using the most CPU. top
has been around for years, but the new(-ish) kid on the block is htop
. Unlike top
, you may need to install htop
yourself.
Keyboard Shortcuts
Superficially, htop
performs similarly to top
, but it has more functionality:
F2
configures the display setupF6
allows sorting by different columnst
will display a process trees
will runstrace
on the highlighted processl
(lowercase L) will show all open files for the highlighted process (usinglsof
)L
will show the library calls for the highlighted process (usingltrace
)- the display may be scrolled horizontally (arrow keys) and vertically (arrow keys or page up/down)
F1
shows more help
Some Practical Uses of htop
- Highlighting a process and pressing the space bar will select that process and show it in a different colour. Multiple processes may be selected, making it easy to track them in the display.
- F9 will kill all selected processes.
- Use
F6
and sort byM_SIZE
to see which processes are using the most memory (physical and virtual)
As always, the man page has more detail.
Could this Linux Tip be improved? Let us know in the comments below.