A detailed description of the Linux top command parameters

Source: Internet
Author: User
Tags terminates cpu usage

Introduction

The top command is a common performance analysis tool under Linux that shows the resource usage of individual processes in the system in real time, similar to the Task Manager for Windows.

Top display system current process and other conditions, is a dynamic display process, that is, you can continue to refresh the current state through the user keys. If the command is executed in the foreground, it will monopolize the foreground until the user terminates the program. More accurately, the top command provides real-time status monitoring of the system's processor. It will display the most "sensitive" CPU in the system Task List. This command can be used by CPU. Memory usage and execution time to sort tasks, and many of the features of the command can be set through interactive commands or in personal customization files.

Here is a detailed description of how it is used.

parameter meaning
top-01:06:48 up 1:22, 1 user, load average:0.06, 0.60, 0.48Tasks:Total, 1 running, 28sleeping, 0 stopped, 0 zombiecpu (s):0.3% us, 1.0% sy, 0.0% ni, 98.7% ID, 0.0% wa, 0.0% Hi, 0%simem:191272k Total, 173656k used, 17616k free, 22052k buffersswap:192772k total, 0k used, 19 2772k free, 123988k cachedpid USER PR NI VIRT RES SHR S%CPU%MEM time+Commandroot0 7976 2456 1980 S 0.7 1.3 0:11.03Sshdroot0 2128 980 796 R 0.7 0.5 0:02.72Toproot0 1992 632 544 S 0.0 0.3 0:00.90Initroot0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0root RT 0 0 0 0 S0.0 0.0 0:00.00 watchdog/0

The first five elements of the statistical information area are the statistical information of the whole system. The first line is the task queue information, with the execution result of the uptime command. The contents are as follows:

01:06:48    1:22     system run time, format last: 1 user    0.06, 0.60, 0.48    system load, that is, the average length of the task queue. The three values were 1 minutes, 5 minutes, and 15 minutes ago to the present average.

The second to third behavior process and CPU information. When there are multiple CPUs, the content may be more than two lines. The contents are as follows:

0.3% US user space consumes CPU percentage 1.0% SY core space consumes CPU percentage 0.0% processes that have changed priority in NI User process space consume CPU percent 98.7% ID Percentage of idle CPU 0.0% wa waiting for the input output CPU time percentage 0.0%Hi: Hardware CPU interrupt consumption percentage 0.0%si: Soft interrupt occupancy percent 0% ST: Virtual machine occupancy percentage

The last two behavior memory information. The contents are as follows:

MEM:191272K    Total Physical memory 173656k used    Total amount of physical memory used 17616k    free memory total 22052k buffers    used as memory swap for kernel cache: 192772K Total    Swap volume 0k used the total amount    of swap area used 192772k    free swap area total 123988k cached    buffer swap area total, in-memory content is swapped out to the swap area, It is then swapped into memory, but the used swap area has not been overwritten, and the value is the size of the swap area that the content already exists in memory, and the corresponding memory is swapped out again without having to write to the swap area.

The details of each process are shown below the process information area statistics area. Let's start by understanding the meaning of the columns.

ordinal column name meaning a PID process IDB PPID parent process IDC ruser Real user named UID process owner Users IDE User process Owner The group name of the F group Process owner, G TTY, initiates the terminal name of the process. Processes that are not started from the terminal are displayed as H PR priority I NI nice value. A negative value represents a high priority, and a positive value indicates the last CPU used by the low-priority J P, which only has meaning in a multi-CPU environment K%CPU time consumed by CPUs last updated to current CPU time total, in seconds per second+ Total CPU time used by the process, Unit 1/100 sec N%the percentage of physical memory used by the MEM process o The total amount of virtual memory used by the VIRT process, in kilobytes. VIRT=swap+The RESp swap process uses the amount of virtual memory that is swapped out, in kilobytes. The size of the physical memory, in kilobytes, that the Q RES process uses and has not been swapped out. RES=code+Datar The physical memory size that the code executable consumes, in parts other than the unit KBS data executable code (data segment+stack) occupies the physical memory size, unit KBT SHR shared memory size, Unit KBU nflt page faults, v NDRT last write to now, number of pages modified. W S Process State (D= Non-interruptible sleep status, r= run, s= sleep, t= track/Stop, z=zombie process) x command name/command line y Wchan if the process is sleeping, the system function name in sleep is displayed Z Flags task flag, reference sched.h

By default, only the more important PID, USER, PR, NI, VIRT, RES, SHR, S,%cpu,%MEM, time+, and COMMAND columns are displayed. You can change the display by using the following shortcut keys.

Change the display by using the F key to select what to display. Press the F key to display a list of columns, press A-Z to show or hide the corresponding column, and then press ENTER to confirm.
Press the o key to change the order in which the columns are displayed. A-Z in the lower case moves the corresponding column to the right, while the uppercase A-Z moves the corresponding column to the left. Finally, press ENTER to confirm.
Press the uppercase F or O key, and then press A-Z to sort the process by the appropriate column. The uppercase R Key can reverse the current sort.

command to use

Top Use Format

Top [-] [d] [P] [Q] [C] [C] [s] [s] [n]

Parameter description

d Specifies the interval between every two times the screen information is refreshed. Of course the user can use the s interactive command to change it. P only monitors the state of a process by specifying the monitoring process ID. Q This option will cause top to refresh without any delay. If the calling program has Superuser privileges, top will run at the highest possible priority. s specifies the cumulative mode s to enable the top command to run in Safe mode. This removes the potential danger of interactive commands. I make top not show any idle or zombie processes. C Displays the entire command line instead of just displaying the command name

Other useful commands
The following are some of the interactive commands that you can use during the execution of the top command. From a point of view of use, mastering these commands is more important than mastering the options. These commands are single-letter, and if you use the S option in command-line options, some of these commands may be masked out.

CTRL +L Erase and rewrite the screen. H or? Display the help screen and give a brief summary of the commands. K       terminates a process. The user will be prompted for the process PID to be terminated and what signal needs to be sent to the process. The normal termination process can use a 15 signal, and if not, use signal 9 to force end the process. The default value is signal 15. This command is masked in safe mode. I ignore idle and zombie processes. This is a switch-type command. Q quit the program. R reschedule the priority level of a process. The user is prompted to enter the process PID that needs to be changed and the process priority value that needs to be set. Entering a positive value lowers the priority and, conversely, it gives the process a higher priority. The default value is 10. S switch to cumulative mode. s changes the delay time between two refreshes. The user will be prompted to enter a new time in S. If there are decimals, it is converted into M S. Enter a value of 0 and the system will refresh continuously, the default value is 5 S. It is important to note that if you set too small a time, it is likely to cause a constant refresh, so it is too late to see the display, and the system load will be greatly increased. F or F Add or remove items from the current display. O or O change the order in which items are displayed. L Toggle Display Average load and start time information. M toggles display memory information. T toggles the display of process and CPU status information. The C toggle Displays the command name and the full command line. M sorts based on the size of the resident memory. P is sorted according to the percentage size of CPU usage. T is sorted by time / accumulated time. W writes the current settings to the ~/.TOPRC file. This is the recommended way to write top configuration files.

Common operations:

Top   //5-second explicit resource usage for all Processes top-d 2  //2-second explicit resource usage for all Processes top-c  //5-second explicit process resource usage, and display the process's command-line arguments (default to process name only) Top-p 12345-p 6789//every 5 seconds the PID is 12345 and the PID is 6789 of the resource consumption of two processes top-d 2-c-P 123456//Every 2 seconds shows the PID is 12345 of the resource usage of the process, and explicitly the process started by the command-line arguments

Transferred from: http://www.w3pop.com/learn/view/p/1/o/1/doc/linux_cmd_top/

A detailed description of the Linux top command parameters

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.