What does the top command output mean?

Posted by Sergey Popov on Wed, 19 Jan 2022 01:46:28 +0100

1. Instance data

Taking centOS8 as an example, record the meaning of the parameters in the output result of the top command.

top -bn 1 > top.txt	//Here, grab the output result of the top command once
top - 23:07:37 up 17:09,  1 user,  load average: 1.01, 0.41, 0.16
Tasks: 256 total,   1 running, 253 sleeping,   2 stopped,   0 zombie
%Cpu(s):  0.0 us,  7.1 sy,  0.0 ni, 92.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :    797.1 total,     72.8 free,    492.6 used,    231.7 buff/cache
MiB Swap:   2048.0 total,   1475.2 free,    572.8 used.    167.9 avail Mem

   PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
  3092 chenlu    20   0 2906716 118480  36208 S  12.5  14.5   1:56.13 gnome-shell
  3707 chenlu    20   0  622160  31092  18484 S   6.2   3.8   0:12.33 gnome-terminal-
     1 root      20   0  242648   4716   2756 S   0.0   0.6   0:03.18 systemd
     2 root      20   0       0      0      0 S   0.0   0.0   0:00.01 kthreadd
     3 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 rcu_gp
     4 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 rcu_par_gp
     6 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kworker/0:0H-kblockd
     8 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 mm_percpu_wq
     9 root      20   0       0      0      0 S   0.0   0.0   0:01.09 ksoftirqd/0
    10 root      20   0       0      0      0 I   0.0   0.0   0:00.90 rcu_sched
    11 root      rt   0       0      0      0 S   0.0   0.0   0:00.00 migration/0
    12 root      rt   0       0      0      0 S   0.0   0.0   0:00.01 watchdog/0

2. Top half: first five lines

first line

top - 23:07:37 up 17:09,  1 user,  load average: 1.01, 0.41, 0.16

Current system time, system running time, current login of several users, cpu load of 1 minute, 5 minutes and 10 minutes (generally no more than 1, if more than 5, it is overloaded)

Second line

Tasks: 256 total,   1 running, 253 sleeping,   2 stopped,   0 zombie

Current processes, running processes, sleep processes, stopped processes, zombie processes

Third line

%Cpu(s):  0.0 us,  7.1 sy,  0.0 ni, 92.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st

cpu occupied by 0.0 us: user process
7.1 sy: cpu occupied by system kernel
0.0 ni: cpu occupied by processes with changed priority in user process space
92.9 id: idle cpu percentage
0.0 wa: percentage of cpu waiting for input / output
0.0 hi: percentage of hardware cpu interrupt usage
0.0 si: percentage of software cpu interrupt usage
0.0 st: virtual machine occupancy percentage

Fourth line

MiB Mem :    797.1 total,     72.8 free,    492.6 used,    231.7 buff/cache

797.1 total: total physical memory unit: MiB
72.8 free: total free memory
492.6 used: total physical memory used
231.7 buff/cache: the amount of memory used as kernel cache

The fifth line

MiB Swap:   2048.0 total,   1475.2 free,    572.8 used.    167.9 avail Mem

2048.0 total: total exchange area
1475.2 free: total free switching area
572.8 used: total number of exchange areas used
167.9 available MEM: the total number of swap buffers

The data in the memory is moved to the swap area and then sent to the memory space. The used swap area has not been overwritten, and its space size is the size of the swap area where these data already exist in the memory. When the corresponding memory is swapped out again, there is no need to write to the swap area

Free size of memory space?

total free=free+buff/cache+avail Mem

3. Second half: details of each process

PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND

PID: process id
USER: process owner name
PR: priority, priority of program execution
NI: NICE value, negative high priority
VIRT: total amount of virtual memory used
RES: the size of physical memory used by the process and not swapped out
SHR: shared memory size
S: Process state (- R running, - s sleep, - T trace / stop, - Z zombie, - D non interruptible sleep state)
%CPU: percentage of CPU time consumed since the last update
%MEM: percentage of physical memory used by the process
TIME +: total CPU TIME used by the process
COMMAND: COMMAND name / COMMAND line

Topics: Linux