(1) The command line
top -hv|-bcHisS -d delay -n limit -u|U user -p pid -w [cols]
# dump top to a text file (-b batch mode)
top -b -n 1 > top.txt
# use command line instead of command name (-c command line switch)
top -bc -n 1 > top.txt
Process Status
'D' = uninterruptible sleep
'R' = running
'S' = sleeping
'T' = traced or stopped
'Z' = zombie
(2) Useful commands
0) Overall
Global-defaults
'A' - Alt display Off (full-screen)
* 'd' - Delay time 3.0 seconds
* 'H' - Threads mode Off (summarize as tasks)
'I' - Irix mode On (no, 'solaris' smp)
* 'p' - PID monitoring Off (show all processes)
* 's' - Secure mode Off (unsecured)
'B' - Bold enable On (yes, bold globally)
Summary-Area-defaults
'l' - Load Avg/Uptime On (thus program name)
't' - Task/Cpu states On (1+1 lines, see '1')
'm' - Mem/Swap usage On (2 lines worth)
'1' - Single Cpu On (thus 1 line if smp)
Task-Area-defaults
'b' - Bold hilite On (not 'reverse')
* 'c' - Command line Off (name, not cmdline)
* 'i' - Idle tasks On (show all tasks)
'R' - Reverse sort On (pids high-to-low)
* 'S' - Cumulative time Off (no, dead children)
* 'u' - User filter Off (show euid only)
* 'U' - User filter Off (show any uid)
'x' - Column hilite Off (no, sort field)
'y' - Row hilite On (yes, running tasks)
'z' - color/mono Off (no, colors)
1) scroll the window
key equivalents
Up alt + \ or alt + k
Down alt + / or alt + j
Left alt + < or alt + h
Right alt + > or alt + l (lower case L)
PgUp alt + Up
PgDn alt + Down
Home alt + Left
End alt + Right
2) Change the "refresh" interval
"d" + enter and then "interval"
3) Column sorting
"R" reverse the sorting
command sorted-field supported
A start time (non-display) No
M %MEM Yes
N PID Yes
P %CPU Yes
T TIME+ Yes
4) Process tree (forest mode)
"V" + enter, press "V" again to exit the mode
5) Filter out idle process
"i" + enter, press "i" again to exit the mode
5) Filter the "owner" process
"u" + "owner", press "U" to exit the mode
6) Searching
"L" + "text needed to search" # case senstive
"&" # next occurrence.
7) Show each CPU usage for SMP
"1" + enter, precess "1" again to exit the mode
8) The interactive commands cheatsheet
"h" + enter