The top command can dynamically view the overall running status of the system in real time. It is a utility tool that integrates multiple information to monitor system performance and running information. The top command is a commonly used performance analysis tool in Linux and can display the resource usage status of each process in the system in real time, similar to the task manager of the Window system
Syntax: top [param]Copy the code
Param is:
- -b: The operation is performed in batch mode.
- -c: displays complete governance commands.
- -d: screen refresh interval.
- -I: ignores the failure process.
- -s: confidential mode.
- -s: cumulative mode.
- -u [User name] : indicates the user name.
- -p [Process NUMBER] : specifies the process.
- -n [times] : indicates the number of times that the loop is displayed.
The top command consists of two parts:
- System Statistics
- System Process Information
System Statistics
Top-11:38:01 UP 231 days, 2:06, 1 User, load Average: 170 total, 1 running, 169 sleeping, 0 stopped, 0 zombie%Cpu(S): 38.7us, 3.5SY, 0.0Ni, 42.0 ID, 15.5wa, 0.0Hi, 0.3Si, 0.0ST
KiB Mem : 8010580 total, 927820 free, 2411572 used, 4671188 buff/cache
KiB Swap: 4063228 total, 2933688 free, 1129540 used. 5153128 avail Mem
Copy the code
-
Row1: indicates the task queue information, the same as the result of the uptime command top-11:38:01 up 231 days, 2:06, 1 User, load Average: 0.88, 0.22, 0.18
- 11:38:01 (Current system time)
- Up 231 days, 2:06
- 1 user (The number of current login users)
- Load Average: 0.88, 0.22, 0.18
-
Row2: Process statistics Tasks: 170 total, 1 running, 169 sleeping, 0 stopped, 0 zombie
- 170 total (Total number of current system processes)
- 1 running (Number of running processes)
- 169 Sleeping (Number of sleep processes)
- 0 Stopped (Number of processes stopped)
- 0 Zombie (Number of zombie processes)
-
CPU (s): 38.7us, 3.5SY, 0.0Ni, 42.0 ID, 15.5wa, 0.0hi, 0.3Si, 0.0ST
- Us, (User space CPU usage)
- 3.5 SY (CPU Usage of Kernel Space)
- 0.0 NI (CPU usage of processes whose user process space has changed priority)
- 42.0 ID (Idle CPU usage)
- 15.5 wa (percentage of CPU time waiting for input/output)
- 0.0% HI (Hardware interrupt request)
- 0.3% SI (Software interrupt Request)
- 0.0% ST (Actual CPU time allocated to tasks running on other virtual machines)
-
Row4: Memory status KiB Mem: 8010580 4671188, 927820 Free, 2411572 Used, 4671188 buff/ Cache
- 4671188 Total (Total physical memory)
- 2411572 Used (Used memory)
- 927820 Free (Free memory)
- Ps: this parameter is used in k
-
Row5: swap Partition information KiB Swap: 4063228 Total, 2933688 Free, 1129540 Used. 5153128 Avail Mem
- 4063228 Total (Total number of switch partitions)
- 1129540 Used (Used swap partition memory)
- 2933688 Free (Free swap partition)
- 5153128 cached
System Process Information
- PID: indicates the ID of a process
- USER: indicates the USER name of the process owner
- PR: indicates the process priority
- NI: Nice value. A negative value indicates a high priority and a positive value indicates a low priority
- VIRT: total virtual memory used by a process (unit: KB). VIRT=SWAP+RES
- RES: size of physical memory used by a process that has not been swapped out (unit: KB). RES=CODE+DATA
- SHR: indicates the size of the shared memory, expressed in KB
- S: indicates the process status. D= uninterruptible sleep state R= Run S= sleep T= track/stop Z= zombie process
- %CPU: indicates the percentage of CPU usage since the last update
- %MEM: percentage of physical memory used by a process
- TIME+ : indicates the total CPU TIME used by a process, expressed in 1/100 of a second
- COMMAND: process name [COMMAND name/COMMAND line]
Press 1 to enable or disable the display of detailed CPU statistics: