Linux TOP Command Summary

Source: Internet
Author: User
This command is commonly used in Linux Performance AnalysisTool to display the resource usage of each process in the system in real time, similar WindowsOf Task Manager. The following describes how to use it.

Top-01:06:48 up :22, 1User, Load average: 0.06, 0.60, 0.48
Tasks: 29Total, 1 running, 28 sleeping, 0 stopped, 0 zombie
CPU (s): 0.3% us, 1.0% Sy, 0.0% Ni, 98.7% ID, 0.0% wa, 0.0% hi, 0.0% Si
Mem: 191272 k total, 173656 K used, 17616 K free, 22052 K Buffers
Swap: 192772 k total, 0 K used, 192772 K free, 123988 K cached

PIDUser PR Ni virt res shr s % CPU % mem time +Command
1379Root16 0 7976 2456 1980 s 0.7 1.3. 03 sshd
14704 root 16 0 2128 980 R 796 0.7. 72 top
1 root 16 0 1992 632 s 544 0.0. 90 init
2 root 34 19 0 0 s 0.0 0.0. 00 ksoftirqd/0
3 root RT 0 0 0 s 0.0 0.0. 00 watchdog/0

Statistical information area
The first five lines are the overall statistics 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 system running time, format: minute
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.

Second and Third, information about the process and CPU. When multiple CPUs exist, the content may exceed two rows. The content is as follows:

Tasks: 29 total process count
1. Number of Running Processes of Running
28 sleeping sleep Processes
0 stopped process count
0 zombie botnets
CPU (s): 0.3% us CPU usage
1.0% Sy CPU usage in kernel space
0.0% percentage of CPU used by processes that have changed their priorities in Ni user process space
98.7% ID idle CPU percentage
0.0% wa CPU time percentage waiting for Input and Output
0.0% hi
0.0% Si

Memory information of the last two behaviors. The content is as follows:

Mem: 191272 k total physical memory
Total physical memory used by 173656 K used
17616 K free Free Memory Total
Memory usage of 22052 K buffers as kernel Cache
Swap: 192772 k total number of swap Areas
Total number of swap areas used by 0 K used
192772 K free swap zone total
The total number of swap areas of the 123988 K cached buffer.
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 in the memory.
When the corresponding memory is swapped out again, you do not have to write data to the swap zone.

Process Information area
The details of each process are displayed at the bottom of the statistics area. First, let's take a look at the meaning of each column.

Serial Number Column name meaning
A pid process ID
B ppid parent process ID
C ruser real User Name
D uid: User ID of the process owner
E User: User Name of the process owner
Group name of the owner of the F group process
The terminal name of the G tty startup process. Processes not started from the terminal are displayed?
H PR priority
I ni nice value. A negative value indicates a high priority, and a positive value indicates a low priority.
The final CPU used by j p is only meaningful in multiple CPU Environments
K % percentage of CPU time used since the last CPU update to the present
LTimeTotal CPU time used by the process, in seconds
M Time + the total CPU time used by the process, in the unit of 1/100 seconds
N % mem percentage of physical memory used by the Process
O total virtual memory used by the virt process, in KB. Virt = swap + Res
The swap size in the virtual memory used by the P SWAp process, in KB.
The size of the physical memory used by the Q res process, Not swapped out, in KB. Res = code + Data
The physical memory occupied by the R code executable code, in KB.
Physical memory occupied by other parts (Data Segment + stack) except the executable code of S data, in KB
T SHR shared memory size, in KB
U nflt page error count
The number of modified pages that the last write to the present by V.
W s Process status.
D = uninterrupted sleep
R = run
S = sleep
T = tracking/stopping
Z = zombie Process
X command name/command line
Y wchan: if the process is sleep, the system function name in sleep is displayed.
Z 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 shortcut keys below to change the display content.

Change the display content:
1. You can use the f key to select the displayed content. Press F to display the column list. Press A-Z to display or hide the corresponding column, and press enter to confirm.

2. Press the O key to change the Column Display sequence. A lower-case a-Z can move the corresponding column to the right, while an upper-case A-Z can move the corresponding column to the left. Press enter.

3. Press the f or O key in upper case, and then press a-Z to sort the process according to the corresponding column. The uppercase r key can reverse the current sorting.

-------------------------- Detailed introduction ----------------------------

Top is an excellent program observation tool! Different from PS, which is the final result of batch computing, the top program can operate the entire system program using the continuous compute (MONITOR, for example, see Example 1 above! In the initial configuration, the time for updating the program resource is 5 seconds. However, you can use-D to modify the resource.

The top is mainly divided into two aspects. The top is the region used by the entire system's data source. There are basically six rows in total, and the content shown in sequence is:

  • Line 1: displays the time when the system has been moved, the number of people currently logged on, and the overall load of the system ). For comparison, it is important to note that the entire system has an average latency of 1, 5, and 10. Generally, this parameter value should not exceed 1 unless your system is busy. If the number is higher than 5, let's look at the program in the whole system!
  • Row 2: displays the number of current monitoring programs. Note the last zombie value if it is not 0! Let's take a good look at the process that has become Xinjiang region ?!
  • Row 3: indicates the CPU overall usage. Can each Metric be used? Check the token. You need to check the ID (idle) value. Generally, it should be close to 100%, indicating that few data sources of the system are used! ^_^.
  • Line 4 and Line 5: displays the usage of the current actual and dynamic memory (MEM/SWAP.
  • Row 6: This is the place where commands are displayed when commands are executed in the top program. Example 4 is a simple example.

To the bottom of the top layer, it is the information source used by each process. Note that:

  • PID: the ID of each process!
  • User: the user of the process;
  • PR: priority's priority. The program's priority is sorted first, and the smaller the value is, the earlier it is written;
  • Ni: the response of Nice is related to priority. The smaller the value, the earlier the response is sent;
  • % CPU: CPU usage;
  • % Mem: indicates the memory usage;
  • Time +: The sum of CPU usage time;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.