Linux Common Commands _top

Source: Internet
Author: User

The top command dynamically displays the overall resources of the system and the resource usage of each process, and is a common performance analysis tool under Linux.

top command Syntax

use format: Top [-] [d] [b] [H] [P] [Q] [C] [C] [s] [s] [n]

Parameter description:

d Specifies the time between each screen refresh interval. P View the status of the specified process through the process ID. N number of refreshes, automatically exit B batch mode after completion , with the "n" parameter, can be used to redirect the results of top to File H View Thread occupation resource status u view the specified user process resource utilization C Displays the entire command line instead of just displaying the command name
Top Usage Examples

View resource usage with process ID 6663, refresh every 2 seconds, view total 10 times

6663 2 Ten  66632 > Data.txt #重定向到文件

Review the thread resource usage for process ID 6663, which is commonly used for performance testing. The difference is the plus parameter-H

6663 2 Ten  66632 > Data.txt #重定向到文件
top command Default output key information interpretation
Top- on: .: -Up1: A,1User, load Average:0.06,0.60,0.48Tasks: inTotal1Running -Sleeping,0Stopped0Zombiecpu (s):0.3% US,1.0% Sy,0.0% Ni,98.7%ID,0.0% WA,0.0% Hi,0.0%simem:191272k Total, 173656k used, 17616k Free, 22052k buffersswap:192772k Total, 0k used, 192772k Free, 123988k cachedpid USER PR NI VIRT RES SHR S%CPU%MEM time+COMMAND1379Root -   0  7976 2456 1980S0.7  1.3   0:11.03sshd14704Root -   0  2128  980  796R0.7  0.5   0:02.72Top1Root -   0  1992  632  544S0.0  0.3   0:00.90Init2Root the   +     0    0    0S0.0  0.0   0:00.00ksoftirqd/03Root RT0     0    0    0S0.0  0.0   0:00.00watchdog/0

Line 1th:load average:0.06, 0.60, 0.48. System Load Statistics Summary

Load average, which represents the system load (the average length of the task queue), three values are 1, 5, 15 minutes ago to the current average. If this number is divided by the number of logical CPUs, the result above 5 indicates that the system is overloaded.

Line 3rd:Cpu (s): 0.3% us, 1.0% sy, 0.0% ni,98.7% ID, 0.0% wa, 0.0% Hi, 0.0% si. Summary of CPU usage information

US user space consumes CPU percent SY core space consumes CPU percentage of processes that have changed priority within NI user process space ID Percentage of Idle CPU WA I/o waiting percentage of CPU time hi hardware CPU outage% si soft interrupt occupancy Percentage St Virtual machine occupancy percentage

Line 4th:mem:191272k Total, 173656k used, 17616k free, 22052k buffers. A summary of memory usage.

Line 5th:swap:192772k Total, 0k used, 192772k free, 123988k cached. Swap space usage Rollup.

Interpretation of the meaning of each field in process resource occupancy

PID Process ID PPID parent Process ID User Process Owner's username PR priority NI Nice value. A negative value represents a high priority, and a positive value represents the total amount of virtual memory used by the low-priority virt process, in kilobytes. VIRTThesize, in kilobytes, of the physical memory that is used by the =swap+ res res process and is not swapped out. RES=code+DATA SHR shared memory size, unit KBS process state. D for non-interruptible sleep state R for running s for Sleep T for tracking /% CPULast updated to current CPU time consumption percentageof CPU time used by the Times process total, units per second time + process CPU times used total, Unit 1 percent of physical memory used by MEM process command process name
Top Interactive Commands
h Display Help interface, give some brief command summary p to sort by CPU percent size M toggle display memory information m sort by resident memory size C Toggle Display command name and full command line T toggle display process and CPU status information K terminates a process. I ignore idle and zombie processes. This is a switch-type command. R reschedule the priority of a process s switch to cumulative mode s to change the delay time between two refreshes (in units of s), and if there are decimals, convert to M S. Enter 0 value and the system will refresh continuously, the default value is 5 SF or F Add or remove items from the current display o or O change the order of display items L toggle display average load and start time information T sort by time / cumulative time W writes the current setting to ~/

Other

Press the number 1, view each CPU performance data, and then press the number 1 to return " Shift + < " " Shift + > ", page flip to view process resource usage information

Linux Common Commands _top

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.