The top common parameters are as follows:
-D: Can be followed by seconds, which is the number of seconds to update the entire program screen. The preset is 5 seconds;
-B: Top is executed in batches, and more parameters are available.
Typically, a data flow redirect is used to output the result of a batch to a file.
-N: With-B, the meaning is that several top outputs are required.
-P: Specify some PID to be observed and monitored.
Key commands you can use during top execution:
? : Display the key commands that can be entered in top;
P: Using the CPU to sort the display of resources;--%CPU
M: Memory using resource sort display;--%mem
N: Sort by PID-from big to small
T: The CPU Time accumulation (time+) used by the Process is sorted.
K: Give a certain PID a signal (signal)
R: Give a PID a nice value again.
Common Command combinations:
[Oracle@bys3 ~]$ top-d 2---Two seconds refresh
[Oracle@bys3 ~]$ top-bn 1 >abc.log---Writes output to the specified file
[Oracle@bys3 ~]$ top-d 2-p 2955---Output only information for the specified process
top-23:57:41 up 6:03, 4 users, Load average:0.02, 0.02, 0.00
Tasks:1 Total, 0 running, 1 sleeping, 0 stopped, 0 zombie
Cpu (s): 0.5%us, 16.4%sy, 0.0%ni, 83.1%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
mem:1026688k Total, 918396k used, 108292k free, 38260k buffers
swap:4249144k Total, 0k used, 4249144k free, 627300k cached
PID USER PR NI virt RES SHR S%cpu%mem time+ COMMAND
2955 oracle-2 0 365m 13m 12m S 13.0 1.4 44:39.75 Oracle
Utility----Use the top command, you can also enter P M N T and so on to sort out the output information-note that it is uppercase.
Interpretation of the top command output information:
Top can continuously monitor the entire system's program working state, and the default is refreshed every 5 seconds.
The output is divided into two parts: Upper 6 lines: System Overview. Lower part: The resource situation used by each process,
The number of process lines that are output by default only when using the top command is not fixed, displayed by window size, and the larger the window displays.
If you use top-bn 1 to output only one result at a time, all of the process information is output-you can redirect the output to a file file view at this point.
Example:
[Oracle@bys3 ~]$ top-bn 1
top-23:30:46 up 5:36, 4 users, Load average:0.00, 0.00, 0.00
tasks:138 Total, 1 running, 137 sleeping, 0 stopped, 0 zombie
Cpu (s): 1.0%us, 19.2%sy, 0.3%ni, 76.1%id, 3.3%wa, 0.0%hi, 0.1%si, 0.0%st
mem:1026688k Total, 933452k used, 93236k free, 35964k buffers
swap:4249144k Total, 0k used, 4249144k free, 638360k cached
PID USER PR NI virt RES SHR S%cpu%mem time+ COMMAND
2955 oracle-2 0 365m 13m 12m S 11.7 1.4 41:13.71 Oracle
1 Root 0 2160 572 484 S 0.0 0.1 0:02.76 Init
2 Root 0 0 0 0 S 0.0 0.0 0:00.01 Kthreadd
The following output is omitted.
Upper part--the first five elements:
First line:
top-23:30:46 up 5:36, 4 users, Load average:0.00, 0.00, 0.00
Same as the uptime output
[Oracle@bys3 ~]$ Uptime
23:36:07 up 5:41, 4 users, Load average:0.00, 0.00, 0.00
System current time, system boot time, the current number of users logged in, 1, 5, 10 minutes of CPU load situation-generally but 1
Second line:
tasks:138 Total, 1 running, 137 sleeping, 0 stopped, 0 zombie
More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/OS/Linux/
Current total number of processes, running, sleeping, stopping, zombie zombie processes-Non 0 to be aware of
Third line:
Cpu (s): 1.0%us, 19.2%sy, 0.3%ni, 76.1%id, 3.3%wa, 0.0%hi, 0.1%si, 0.0%st
CPU proportions consumed by the user process, the kernel Beats CPU proportions, the user process that has changed the priority consumes CPU percentage, free CPU percent,
Percentage of CPU time waiting for input output
Line four:
mem:1026688k Total, 933452k used, 93236k free, 35964k buffers
Total physical memory-there are units K, already used, idle, kernel-buffered intrinsic amount
Line five:
swap:4249144k Total, 0k used, 4249144k free, 638360k cached
Total size of Swap space-unit k, already used, idle, buffered swap area total-used and not overwritten swap
###############################################
Part Two: Process details--specific meaning of each column of the process
PID USER PR NI virt RES SHR S%cpu%mem time+ COMMAND
2955 oracle-2 0 365m 13m 12m S 11.7 1.4 41:13.71 Oracle
The specific meaning of each column of process information:
PID Process ID,
USER Process owner name,
PR Priority, program priority execution order, the smaller the sooner be executed
NI nice value-negative high priority,
Total amount of virtual memory used by Virt;
The amount of physical memory used by the RES process that has not been swapped out
SHR Shared memory size.
S process state-R run-S sleep-t trace/stop-Z zombie-D non-disruptive sleep state
%cpu percentage of CPU time that was last updated to current
Percentage of physical memory used by the%MEM process
Total CPU time used by the time+ process, in units 1/100 seconds-milliseconds
Command name/command line