Linux TOP Command Parameters

Source: Internet
Author: User
Tags superuser permission
Introduction

The top command is a common performance analysis tool in Linux. It can display the resource usage of various processes in the system in real time, similar to the Windows Task Manager.

Top displays the current process and other conditions of the system. It is a dynamic display process, that is, you can press the buttons to continuously refresh the current status. if you execute this command on the foreground, it will exclusively occupy the foreground until the user terminatesProgramUntil. more accurately, the top command provides real-time monitoring of the status of the system processor. it displays the list of CPU-sensitive tasks in the system. this command can be used by CPU. the memory usage and execution time are used to sort tasks. Many features of this command can be set through interactive commands or in a custom file.

The following describes how to use it.

Parameter description
Top- 01 : 06 : 48 Up 1 : 22 , 1 User, load average:0.06 , 0.60 , 0.48 
Tasks: 29 Total, 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

PID user PR Ni virt res shr s % CPU % mem time + command
1379 Root 16 0 7976 2456 1980 S 0.7 1.3 0 : 11.03 Sshd
14704 Root 16 0 2128 980 796 R 0.7 0.5 0 : 02.72 Top
1 Root 16 0 1992 632 544 S 0.0 0.3 0 : 00.90 Init
2 Root 34 19 0 0 0 S 0.0 0.0 0 : 00.00 Ksoftirqd/ 0
3 Root RT 0 0 0 0 S 0.0 0.0 0 : 00.00 Watchdog/ 0

The first five lines in the statistical information area are the overall statistical information 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:48Current Time
Up1:22System running time, in the format of minutes
1Current User Login User count
Load average:0.06,0.60,0.48System 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:
29Total process count
1Number of Running Processes of Running
28Number of sleeping Processes
0Number of stopped Processes
0Zombie botnets
CPU (s ):
0.3% Us CPU usage
1.0% Sy CPU usage in kernel space
0.0% Ni CPU usage percentage of processes that have changed their priorities in the process space
98.7% ID idle CPU percentage
0.0% Wa CPU time percentage waiting for Input/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 swap zone total
Total number of swap areas used by 0 K used
192772 K free swap zone total
The total number of swap zones in 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 is not covered yet, this value indicates the size of the SWAp zone where the content already exists. When the corresponding memory is swapped out again, you do not have to write data to the swap zone.

 

Detailed information about each process is displayed at the bottom of the process information 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
L total CPU time used by the time 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
R code executableCodePhysical memory occupied, 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 = non-disruptive sleep status, r = running, 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 throughFKey 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.
PressOThe key can 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.
In upper caseFOrOAnd then press a-Z to sort the process by the corresponding column. In upper caseRThe key can reverse the current sorting.

Command usage

Top format

Top [-] [d] [p] [Q] [C] [C] [s] [s] [N]

Parameter description

 
D. Specify the interval between two screen information refreshes. Of course, you can use the S interactive command to change it.
P only monitors the status of a process by specifying the monitoring process ID.
Q This option will refresh top without any delay. If the caller has the superuser permission, top runs with the highest possible priority.
S indicates the accumulative mode.
S enables the TOP command to run in safe mode. This removes the potential danger of interactive commands.
I so that top does not show any idle or dead processes.
C. display the entire command line, not just the command name.

Other practical commands
The following describes some interactive commands that can be used during TOP command execution. From the perspective of usage, mastering these commands is more important than mastering the options. These commands are single-letter. If the s option is used in the command line option, some of these commands may be blocked.

CTRL + l erase and override the screen.
H or? The help screen is displayed, and some brief command summary is provided.
K. terminate a process. The system prompts the user to enter the PID of the process to be terminated and the signal to be sent to the process. Generally, 15 signals can be used to terminate a process. If the process cannot end normally, use signal 9 to forcibly end the process. The default value is signal 15. This command is blocked in security mode.
I ignore idle and dead processes. This is a switch-on command.
Q: exit the program.
R reschedules the priority of a process. The system prompts the user to enter the process PID to be changed and the process priority value to be set. Entering a positive value will lower the priority, and vice versa will give the process a higher priority. The default value is 10.
S switches to the accumulative mode.
S changes the delay time between two refreshes. The system prompts the user to enter a new time in seconds. If there is a decimal number, it is converted to m s. If the input value is 0, the system will be refreshed continuously. The default value is 5 s. It should be noted that if the setting is too small, it is likely to cause constant refresh, so it is too late to see the display, and the system load will increase significantly.
F or F: add or delete a project from the current display.
O or O changes the order of projects displayed.
L switching displays average load and startup time information.
The m switch displays the memory information.
T Switch displays the process and CPU status information.
C switch to display the command name and complete command line.
M is sorted Based on the resident memory size.
P is sorted by CPU usage percentage.
T is sorted by time/accumulative time.
W write the current settings ~ /. Toprc file. This is a recommended method for writing top configuration files.

 

Common Operations:

Top//Displays the resource usage of all processes every five seconds.
Top-d2//Displays the resource usage of all processes every 2 seconds.
Top-C//Displays the resource usage of a process every five seconds and the command line parameters of the process (only the process name is used by default)
Top-P12345-P6789//The CPU usage of two processes whose PID is 12345 and PID is 6789 is displayed every five seconds.
Top-d2-C-P123456 //Shows the resource usage of a process whose PID is 12345 every 2 seconds, and explicitly displays the command line parameters started by the process.

 

from: http://www.w3pop.com/learn/view/p/1/o/1/doc/linux_cmd_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.