'top' is more powerful than you think
With a lot of ‘top’ alternatives like htop or btop, you may think ‘top’ is a not-so-useful command, but you can customize its output in multiple ways.
Table of Contents
Command-line options
top
admits several parameters:
top -d <seconds>
: delay-time interval. You can use decimals:top -d 1.5
.top -p <PID>
: monitor specific Process IDs (PID). You can add up to 20 PIDs.top -U <user>
: display processes from a user ID or user name.
Interactive commands
Inside top
you can press these keys:
- f: fields management window. Add, remove and move
top
columns using arrow keys (to navigate, select and move entries) and d or space key to add or remove. To close this window, press q or Esc. - d +
<seconds>
: you can change the delay insidetop
as well. - l: toggle load-average/uptime line.
- t: toggle task/cpu-states lines (four modes).
- m: toggle memory lines (four modes).
- c: display command line or program name.
- j or J: alternate between right-justified numbers or names, and left-justified.
- <: move sort column to the left.
- >: move sort column to the right.
- R: toggle reverse sorting.
- 1: single/separate CPU-states toggle.
- u +
<username>
: display processes from a user. - o +
<fieldname>=<value>
: filter processes by field value (e.g.:!USER=root
excludes processes owned byroot
).
More
Run man top
for more info.
Featured content: