Linux top command

Source: Internet
Author: User
Top common parameters are as follows:-d: followed by the number of seconds, that is, the number of seconds that the entire program screen is updated. The default value is 5 seconds.-B: top is executed in batches. more parameters can be used as follows:-d: followed by the number of seconds, it is the number of seconds that the entire program screen is updated. The default value is 5 seconds;
-B: execute top in batches. you can also use more parameters!
Usually, batch results are output as files with data stream redirection.
-N: used with-B. It indicates that the output result of the top number is required.
-P: specify some PIDs for observation and monitoring.
Key commands that can be used during top execution:
? : Key commands that can be entered in top;
P: sorted by CPU usage resources; -- % CPU
M: sorted by Memory usage resources; -- % MEM
N: Sort by PID-from large to small
T: the cpu time accumulation (TIME +) used by the Process is sorted.
K: Give a PID a signal (signal)
R: Give a PID a nice value.
Common Command combinations: [oracle @ bys3 ~] $ Top-d 2 --- refresh once every two seconds
[Oracle @ bys3 ~] $ Top-bn 1> abc. log --- write the output to the specified file
[Oracle @ bys3 ~] $ Top-d 2-p 2955 --- only output the information of the specified process
Top-23:57:41 up, 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: 1026688 k total, 918396 k used, 108292 k free, 38260 k buffers
Swap: 4249144 k total, 0 k used, 4249144 k free, 627300 k cached
Pid user pr ni virt res shr s % CPU % mem time + COMMAND
2955 oracle-2 0 365 m 13 m 12 m S 13.0 1.4 44: 39.75 oracle

Practical ----After using the top command, you can also enter p m n t and other pairs to sort the output information -- Note: uppercase is used..? Number to call up help.

Explanation of TOP command output information:Top can continuously monitor the operating status of the entire system program. by default, it is refreshed every 5 seconds.
The output is divided into the upper and lower parts: the upper six rows: System Overview. Lower part: resources used by each process,
When the top command is used by default, the number of output process rows in this part is not fixed and displayed by window size. the larger the window, the more it is displayed.
If top-bn 1 is used, only one result is output, all process information is output. in this case, the output can be redirected to the file for viewing.
Example:
[Oracle @ bys3 ~] $ Top-bn 1
Top-23:30:46 up, 4 users, load average: 0.00, 0.00, 0.00
Task: 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: 1026688 k total, 933452 k used, 93236 k free, 35964 k buffers
Swap: 4249144 k total, 0 k used, 4249144 k free, 638360 k cached

Pid user pr ni virt res shr s % CPU % mem time + COMMAND
2955 oracle-2 0 365 m 13 m 12 m S 11.7 1.4 41: 13.71 oracle
1 root 20 0 2160 572 S 484 0.0. 76 init
2 root 20 0 0 0 S 0.0 0.0. 01 kthreadd
The following output is omitted.
Previous section -- first five lines: The first line:
Top-23:30:46 up, 4 users, load average: 0.00, 0.00, 0.00
Same as uptime output
[Oracle @ bys3 ~] $ Uptime
23:36:07 up, 4 users, load average: 0.00, 0.00, 0.00
Current system time, system start time, number of users currently logged in, CPU load for 1, 5, and 10 minutes-generally less than 1
Row 2:
Task: 138 total, 1 running, 137 sleeping, 0 stopped, 0 zombie
Current total number of processes, running, sleep, stopped, zombie processes-check for non-0
Row 3:
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 usage of user processes, kernel-over CPU usage, CPU usage of user processes that have changed their priorities, idle CPU usage,
Percentage of CPU time waiting for input and output
Row 4:
Mem: 1026688 k total, 933452 k used, 93236 k free, 35964 k buffers
Total physical memory-unit K, used, idle, and internal volume of kernel buffer
Fifth line:
Swap: 4249144 k total, 0 k used, 4249144 k free, 638360 k cached
Total size of SWAP space-unit K, used, idle, and buffered SWAP zone total-used and unoverwritten SWAP
######################################## #######
Part 2: process details-specific meanings of process columns pid user pr ni virt res shr s % CPU % mem time + COMMAND
2955 oracle-2 0 365 m 13 m 12 m S 11.7 1.4 41: 13.71 oracle
The specific meanings of process information columns:
PID process ID,
USER process owner name,
The abbreviation of PR Priority, the execution order of the program, the smaller the earlier the execution
Ni nice value-negative high priority,
Total virtual memory used by VIRT;
Physical memory size used by the RES process and not swapped out
The size of the shared memory of the SHR.
S process status-R run-S sleep-T trace/stop-Z zombie-D uninterruptible sleep status
% Percentage of CPU time used since the last CPU update to the present
% MEM percentage of physical memory used by the process
TIME + total cpu time used by the process, in the unit of 1/100 seconds-millisecond
COMMAND name/COMMAND line

Related Article

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.