Tool for real-time monitoring or viewing system resource usage-TOP
The top command is a common performance analysis tool in Linux. It can display the resource usage of various processes in the system in real time, similar to the Windows Task Manager.
The following describes how to use it:
(Real-time monitoring system resource usage diagram)
The first five lines in the statistical information area are the overall statistical information of the system:
The first line is the task queue information, which is the same as the execution result of the uptime command. The content is as follows:
01:06:48 |
Current Time |
Up :22 |
System running time, in the format of minutes |
1 user |
Current Login User count |
Load average: 0.06, 0.60, 0.48 |
System load, that is, the average length of the task queue. The three values are the average values from 1 minute, 5 minutes, and 15 minutes ago to the present. |
2. 3. Information about the process and CPU. When multiple CPUs exist, the content may exceed two lines. The content is as follows:
Tasks: 29 total |
Process count |
1 running |
Number of Running Processes |
28 sleeping |
Number of sleep Processes |
0 stopped |
Number of stopped Processes |
0 zombie |
Number of zombie Processes |
Cpu (s): 0.3% us |
CPU usage percentage of user space |
1.0% sy |
CPU usage of kernel space |
0.0% ni |
CPU usage percentage of processes that have changed their priorities in the process space |
98.7% id |
Idle CPU percentage |
0.0% wa |
Percentage of CPU time waiting for Input and Output |
0.0% hi |
Total time consumed by CPU service during hard interruption |
0.0% si, 0.0% st |
Total CPU service Time spent on Soft Interrupt, Steal Time |
The memory information of the last two behaviors is as follows:
Mem: 191272 k total |
Total physical memory |
173656 k used |
Total physical memory used |
17616 k free |
Total idle memory |
22052 k buffers |
Memory Used as kernel Cache |
Swap: 192772 k total |
Total number of swap Areas |
0 k used |
Total number of swap zones used |
192772 k free |
Total number of idle swap Areas |
123988 k cached |
The total number of buffer swap areas. The content in the memory is swapped out to the swap zone and then into the memory, but the used swap zone has not been overwritten, This value indicates the size of the SWAp zone where the content already exists. When the corresponding memory is swapped out again, you do not have to write data to the swap zone. |
Detailed information about each process is displayed at the bottom of the process information area.
First, let's get to know the meaning of each column:
Serial number |
Column name |
Description |
1 |
PID |
Process id |
2 |
PPID |
Parent process id |
3 |
RUSER |
Real user name |
4 |
UID |
User ID of the process owner |
5 |
USER |
User Name of the process owner |
6 |
GROUP |
Group Name of the process owner |
7 |
TTY |
The terminal name of the startup process. If the process is not started from the terminal, it is displayed? |
8 |
PR |
Priority |
9 |
NI |
Nice value. negative value indicates high priority, positive value indicates low priority |
10 |
P |
The last CPU used is only meaningful in multiple CPU environments. |
11 |
% CPU |
CPU usage from the last update to the present |
12 |
TIME |
Total CPU time used by the process, in seconds |
13 |
TIME + |
Total CPU time used by the process, in 1/100 seconds |
14 |
% MEM |
Percentage of physical memory used by the Process |
15 |
VIRT |
Total virtual memory used by the process, in kb, VIRT = SWAP + RES |
16 |
SWAP |
The swap size in the virtual memory used by the process, in kb. |
17 |
RES |
Physical memory used by the process, not swapped out, in kb, RES = CODE + DATA |
18 |
CODE |
Physical memory occupied by executable code, in kb |
19 |
DATA |
Physical memory occupied by parts other than executable code (Data Segment + stack), in kb |
20 |
SHR |
Size of shared memory, in kb |
21 |
NFLT |
Page error count |
22 |
MCM t |
The number of pages that have been modified since the last write to the present. |
23 |
S |
Process status: D= Uninterrupted sleep R= Run S= Sleep T= Trail/stop Z= Zombie Process |
24 |
COMMAND |
Command name/command line |
25 |
WCHAN |
If the process is sleeping, the system function name displayed in sleep |
26 |
Flags |
Task flag, refer to sched. h |
By default, only important PID, USER, PR, NI, VIRT, RES, SHR, S, % CPU, % MEM, TIME +, and COMMAND columns are displayed!
You can use the following shortcut keys to change the display content:
Change the display content throughFYou can select the displayed content (press f to display the list of columns, press a-z to display or hide the corresponding columns, and press enter to confirm)
PressOThe key can change the Column Display order (a-z in lower case can move the corresponding column to the right, while the upper-case A-Z can move the corresponding column to the left, and finally press the Enter key to confirm)
In upper caseFOrOKey, and then press a-z to sort the process according to the corresponding columns, and the upper caseRThe key can reverse the current sorting.
Reference:
Linux top commands
Http://bbs.linuxtone.org/forum.php? Mod = viewthread & tid = 1684 & fromuid = 34304