top
This document summarizes the usage of top, which displays processes sorted by CPU usage or memory usage.
1. top
1.1. top
$ top
top - 10:27:27 up 36 min, 3 users, load average: 0.00, 0.01, 0.05
Tasks: 238 total, 1 running, 237 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.2 us, 0.1 sy, 0.0 ni, 99.7 id, 0.1 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem: 8052812 total, 1053584 used, 6999228 free, 49428 buffers
KiB Swap: 8265724 total, 0 used, 8265724 free. 541164 cached Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1848 root 20 0 1175416 103756 61724 S 0.7 1.3 0:12.55 compiz
1349 root 20 0 601840 69188 53208 S 0.3 0.9 0:05.81 Xorg
2824 root 20 0 30372 3544 2976 R 0.3 0.0 0:00.06 top
1 root 20 0 34024 4464 2616 S 0.0 0.1 0:00.80 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 0:00.52 ksoftirqd/0
5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:+
7 root 20 0 0 0 0 S 0.0 0.0 0:00.33 rcu_preempt
8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_sched
9 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh
10 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
11 root rt 0 0 0 0 S 0.0 0.0 0:00.01 watchdog/0
12 root rt 0 0 0 0 S 0.0 0.0 0:00.01 watchdog/1
13 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/1
14 root 20 0 0 0 0 S 0.0 0.0 0:00.44 ksoftirqd/1
16 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/1:+
17 root rt 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/2[Shell 1] shows what can be checked through top. The upper part outputs CPU and memory information, and the lower part outputs process information sorted in descending order by CPU usage.
1.1.1. CPU Information
The %Cpu(s) part in the upper part of [Shell 1] represents the average CPU usage of all CPU cores. Each column has the following meaning:
us (user): CPU usage rate for running user code of processes without nice value applied (un-niced, nice = 0). Represents usage rate of most user processessy (system): CPU usage rate for running kernel code, excluding usage/idle rates of id, wa, hi, sini (nice): CPU usage rate for running user code of processes with nice value applied (niced)id (idle): CPU idle rate excluding I/O Waitwa (wait): CPU idle rate due to I/O Waithi (hardware interrupt): CPU usage rate used for pure hardware interrupt processing. Represents CPU usage rate for processing the top halves part that only sets interrupt flags in the kernelsi (sotware interrupt): CPU usage rate of bottom halves that actually process interrupts according to interrupt flags set by top halvesst (steal): CPU usage rate stolen by the hypervisor or other virtual machines when the kernel runs inside a virtual machine controlled by a hypervisor
1.1.2. Memory Information
Between the CPU information and process information in [Shell 1], memory usage is displayed. Each item has the following meaning:
Mem total: Total memory capacityMem used: Memory capacity in useMem free: Memory capacity not in useSwap total: Total swap capacitySwap used: Swap capacity in useSwap free: Swap capacity not in usebuffers: Memory capacity used as kernel buffercached Mem: Memory capacity used as kernel cache
1.1.3. Process Information
The lower part of [Shell 1] outputs process information. Each column has the following meaning:
PID: Process IDUSER: Process ownerPR: Scheduling priority actually used during kernel scheduling. Can have values “0 ~ 39, rt”, and in the case of numbers, lower values have higher priority. rt means Real Time Scheduling Priority and has higher priority than priority 0NI: nice value. Can have values “-20 ~ 19”, and lower numbers have higher priority. “20 + NI” becomes PRVIRT: Virtual memory capacity. Means the sum of all memory capacity and swap capacity allocated for the process, even if not currently in useRES: Actual memory capacity currently in use. Part of VIRTSHR: Shared memory capacity. Part of RESS: Process state%CPU: CPU usage rate%MEM: Memory usage rateTIME+: Process runtimeCOMMAND: Process command
1.1.4. Shortcuts
- 1 : Outputs usage per CPU core
- SHIFT + M : Sorts by memory usage
- SHIFT + P : Sorts by CPU usage
- SHIFT + T : Sorts by runtime