top

Table of Contents

top reference

top
top -b          # Batch-mode (not refreshing, just append the output)
top -n <number> # Number of iterations. After refreshing number times, top exits.
top -p <pid>    # Monitor PIDs

E - Change memory scale of summary

MiB Mem : 3951.434 total, 2841.020 free,  592.242 used,  518.172 buff/cache
MiB Swap: 4092.996 total, 4092.996 free,    0.000 used. 3115.512 avail Mem
GiB Mem :    3.859 total,    2.774 free,    0.579 used,    0.506 buff/cache
GiB Swap:    3.997 total,    3.997 free,    0.000 used.    3.042 avail Mem

e - Change memory scale of tasks

1490 yeongho+  20   0 1203.0m 162.8m  71.6m S  5.0  4.1   0:25.77 compiz
 890 root      20   0  299.7m  69.7m  28.6m S  0.3  1.8   0:02.42 Xorg
   1 root      20   0  117.1m   5.9m   3.9m S  0.0  0.1   0:00.94 systemd
   2 root      20   0    0.0m   0.0m   0.0m S  0.0  0.0   0:00.00 kthreadd
1490 yeongho+  20   0  1.175g 0.159g 0.070g S  6.7  4.1   0:26.55 compiz
 890 root      20   0  0.293g 0.068g 0.028g S  0.7  1.8   0:02.47 Xorg
   1 root      20   0  0.114g 0.006g 0.004g S  0.0  0.1   0:00.94 systemd
   2 root      20   0  0.000g 0.000g 0.000g S  0.0  0.0   0:00.00 kthreadd

l - Load Average

top - 21:52:09 up 9 min,  2 users,  load average: 0.02, 0.08, 0.07

t - Task/CPU Stats

Tasks: 175 total,   1 running, 174 sleeping,   0 stopped,   0 zombie
%Cpu(s):  3.7 us,  0.3 sy,  0.0 ni, 96.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu(s):   3.4/0.3     4[|||

m - Memory info

KiB Mem :  4046268 total,  2908216 free,   606148 used,   531904 buff/cache
KiB Swap:  4191228 total,  4191228 free,        0 used.  3190404 avail Mem
KiB Mem : 21.2/4046268  [||||||||||||||||||                                                                      ]
KiB Swap:  0.0/4191228  [                                                                                        ]

0 - Toggle zeros

1857 yeongho+  20   0   97496   3940   2944 S  0.3  0.1   0:00.91 sshd
2023 root      20   0       0      0      0 S  0.3  0.0   0:00.12 kworker/0:1
2034 yeongho+  20   0   50264   4032   3308 R  0.3  0.1   0:00.26 top
890 root      20   0  306860  71340  29248 S  0.3  1.8   0:04.25 Xorg
  1 root      20   0  119868   6080   4044 S       0.2   0:00.94 systemd
  2 root      20   0                       S                     kthreadd

1 - Toggle single/separate CPU states

%Cpu(s):  1.0 us,  0.2 sy,  0.0 ni, 98.8 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu0  :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu1  :  0.3 us,  0.0 sy,  0.0 ni, 99.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu2  :  0.3 us,  0.0 sy,  0.0 ni, 99.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu3  :  1.3 us,  0.0 sy,  0.0 ni, 98.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st

2 - NUMA-Nodes/CPU summary

%Cpu(s):  0.8 us,  0.1 sy,  0.0 ni, 99.2 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Node0 :  0.8 us,  0.1 sy,  0.0 ni, 99.2 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st

3 - Expand-NUMA-Node

expand which node (0-0)
%Node0 :  0.8 us,  0.2 sy,  0.0 ni, 99.0 id,  0.0 wa,  0.0 hi,  0.1 si,  0.0 st
%Cpu0  :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu1  :  1.0 us,  0.0 sy,  0.0 ni, 98.7 id,  0.0 wa,  0.0 hi,  0.3 si,  0.0 st
%Cpu2  :  0.7 us,  0.3 sy,  0.0 ni, 99.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu3  :  1.3 us,  0.3 sy,  0.0 ni, 98.3 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st

I - Toggle Irix mode

if 'Irix mode' is Off, top will operate in 'Solaris mode' where a task's cpu usage will be divided by the total number of CPUs.

f or F - Fields menu

X - Increase fix-width

width incr is 0, change to (0 default, -1 auto) 10
  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 1632 yeongho+  20   0 1328920 163696  73764 S   4.3  4.0   6:44.19 compiz
 PID USER                PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
1632 yeonghoey           20   0 1328920 163696  73764 S   4.3  4.0   6:45.42 compiz

L, & - Locate and find again

<, > - Move sort column

R - Reverse sort

H - Threads

V - Forest view

 928 root      20   0  365900   7952   7092 S   0.0  0.2   0:00.02  `- lightdm
 984 root      20   0  342396  71584  29188 S   0.3  1.8   0:30.51      `- Xorg
1239 root      20   0  228240   6252   5528 S   0.0  0.2   0:00.00      `- lightdm
1280 yeongho+  20   0   54828   4936   3808 S   0.0  0.1   0:00.11          `- upstart
1393 yeongho+  20   0   41208    284     12 S   0.0  0.0   0:00.00              `- upstart-udev-br
1401 yeongho+  20   0   43620   4008   2748 S   0.0  0.1   0:00.29              `- dbus-daemon
1413 yeongho+  20   0   94700   9288   8700 S   0.0  0.2   0:00.01              `- window-stack-br
1441 yeongho+  20   0   49636    392     12 S   0.0  0.0   0:00.00              `- upstart-file-br
1442 yeongho+  20   0  213536   6924   6192 S   0.0  0.2   0:00.01              `- gnome-keyring-d
1453 yeongho+  20   0   41144    320     12 S   0.0  0.0   0:00.01              `- upstart-dbus-br
1458 yeongho+  20   0   41144    324     12 S   0.0  0.0   0:00.04              `- upstart-dbus-br
1459 yeongho+  20   0  174888    728    456 S   0.0  0.0   0:00.16              `- gpg-agent

c - Toggle command name/line

1632 yeongho+  20   0 1328920 163696  73764 S   6.0  4.0   7:21.33 compiz
1743 yeongho+  20   0 1313444  90980  25600 S   0.0  2.2   0:02.20 gnome-software
 984 root      20   0  342396  71584  29188 S   0.0  1.8   0:31.45 Xorg
1632 yeongho+  20   0 1328920 163696  73764 S   4.2  4.0   7:22.06 compiz
1743 yeongho+  20   0 1313444  90980  25600 S   0.0  2.2   0:02.20 /usr/bin/gnome-software --gapplication-service
 984 root      20   0  342396  71584  29188 S   0.3  1.8   0:31.50 /usr/lib/xorg/Xorg -core :0 -seat seat0 -auth+

i - Exclude Idle tasks

S - Cumulative-time (CPU time is cumulated along children processes)

J, j - Num/Str justify

1 root      20   0  119916   6116   4028 S       0.2   0:01.01 systemd
2 root      20   0                       S                     kthreadd
3 root      20   0                       S                     ksoftirqd/0
1     root     20  0   119916  6116   4028   S      0.2  0:01.01   systemd
2     root     20  0                         S                     kthreadd
3     root     20  0                         S                     ksoftirqd/0
1         root 20  0   119916  6116   4028   S      0.2  0:01.01                                           systemd
2         root 20  0                         S                                                            kthreadd
3         root 20  0                         S                                                         ksoftirqd/0
5         root 0   -20                       S                                                        kworker/0:0H

x - Toggle highlight of sort field

y - Toggle highlight of running tasks

z - Toggle color/mono

b - Toggle bold/reverse

u - Filter by effective user

U - Filter by any user

o, O - Other filter (o for ignoring cases on values)

add filter #1 (ignoring case) as: [!]FLD?VAL USER=yeonghoey
  PID USER                PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 1632 yeonghoey           20   0 1328920 163696  73764 S   4.7  4.0   7:58.95 compiz
  984 root                20   0  342396  71584  29188 S   0.3  1.8   0:34.10 Xorg
    1 root                20   0  119916   6116   4028 S   0.0  0.2   0:01.05 systemd
 PID USER                PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
1632 yeonghoey           20   0 1328920 163696  73764 S   3.0  4.0   8:00.66 compiz
2863 yeonghoey           20   0   50280   4172   3472 R   0.3  0.1   0:00.33 top
1267 yeonghoey           20   0   45360   4708   3816 S   0.0  0.1   0:00.00 systemd

^O - Show other filters (Ctrl + o)

=, + - Reset filltering current / all windows

n or # - Set max tasks displayed

Maximum tasks = 0, change to (0 is unlimited) 1
  PID USER                PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 1632 yeonghoey           20   0 1328920 163696  73764 S   4.3  4.0   8:05.90 compiz
 2040 yeonghoey           20   0  527464  25956  22088 S   0.0  0.6   0:00.16 update-notifier
 2081 yeonghoey           20   0  553132  29424  24780 S   0.0  0.7   0:00.17 unity-panel-ser
 2863 yeonghoey           20   0   50280   4172   3472 R   0.0  0.1   0:00.36 top
 PID USER                PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
1632 yeonghoey           20   0 1328920 163696  73764 S   4.3  4.0   8:06.62 compiz

C - Scroll coordinates by following arrow keys

scroll coordinates: y = 17/206 (tasks), x = 1/12 (fields)
PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 18 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 [kworker/1:0H]
 19 root      20   0       0      0      0 S   0.0  0.0   0:00.00 [cpuhp/2]
 scroll coordinates: y = 17/206 (tasks), x = 9/12 (fields)
%CPU %MEM     TIME+ COMMAND
 0.0  0.0   0:00.00 [kworker/1:0H]
 0.0  0.0   0:00.00 [cpuhp/2]

k - Kill a task

PID to signal/kill [default pid = 1632]

r - Renice a task

PID to renice [default pid = 1632]
Renice PID 1632 to value

d or s - Set update interval

Change delay from 3.0 to

SPC - Refresh immediately

W - Write configuration file

Wrote configuration to '/home/yeonghoey/.toprc'

Y - Inspect other output for a process

inspect at PID [default pid = 1632]
  PID USER                PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 1632 yeonghoey           20   0 1328920 163696  73764 S   5.0  4.0   8:19.00 compiz
Inspection Pause at: pid 1632 running compiz as user yeonghoey
Use:  left/right then <Enter> to select an option; 'q' or <Esc> to end !
Options:  Open Files  NUMA Info  Log

g - Choose another field group

Choose field group (1 - 4) 4
  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
PID  PPID   UID USER     RUSER    TTY          TIME+  %CPU %MEM S COMMAND

A - Toggle Single / Multiple windows

a, w - Cycle through all four windows

- (dash) - Show/Hide current window

_ (underscore) - All visiable/invisiable