Linux commands (9) Top

Source: Internet
Author: User
Tags sorts terminates

Source: http://www.jb51.net/LINUXjishu/34604.html Top is a dynamic display process that allows you to constantly refresh the current state by pressing the user key. 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.
Top-12:38:33 up to 23:15, 7 users, Load average:60.58, 61.14, 61.22tasks:203 Total, running, 139 sleeping, 4 stopped, 0 zombiecpu (s): 27.0%us, 73.0%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%stmem:1939780k to Tal, 1375280k used, 564500k free, 109680k buffersswap:4401800k total, 497456k used, 3904344k free, 848712k CAC   Hedpid USER PR NI VIRT RES SHR S%cpu%MEM time+ COMMAND 4338 Oracle 25    0 627m 209m 207m r 0 11.0 297:14.76 Oracle 4267 Oracle 0 626m 144m 143m r                                  6 7.6 89:16.62 Oracle 3458 Oracle 0 672m 133m 124m R 0 7.1 1283:08 Oracle                                 3478 Oracle 0 672m 124m 115m R 0 6.6 1272:30 Oracle    3395 Oracle 0 672m 122m 113m R 0 6.5 1270:03 Oracle 3480 Oracle 0 672m 122m 109M R 8 6.4 1274:13 Oracle 3399 Oracle 0 672m 121m 110m R 0 6.4 1279:37                                Oracle 4261 Oracle 0 634m 100m 99m R 0 5.3 86:13.90 Oracle 25737 Oracle 0 632m 81m 74m R 0 4.3 272:35.42 oracle 7072 o  Racle 0 626m 72m 71m R 0 3.8 6:35.68 Oracle 16073 Oracle 0 630m 68m 63m R 8 3.6 175:20.36 Oracle 16140 Oracle 0 630m 66m 60m R 0 3.5 17                                  5:13.42 Oracle 16122 Oracle 0 630m 66m 60m R 0 3.5 176:47.73 Oracle                                 786 Oracle 0 627m 63m 63m R 0 3.4 1:54.93 Oracle  4271 Oracle 0 627m 59m 58m R 8 3.1 86:09.64 Oracle 4273 Oracle 25 0  627m 57m 56m R 83.0 84:38.20 Oracle 22670 Oracle 0 626m 50m 49m R 0 2.7 84:55.82 Oracle

  

I. Top FIVE ELEMENTS statistics

The first five elements of the statistical information area are the statistical information of the whole system.

  1. The first line is the task queue information

Results of execution with uptime command:

[Email protected] ~]# uptime

13:22:30 up 8 min, 4 users, Load average:0.14, 0.38, 0.25

The contents are as follows:

12:38:33

Current time

Up 50days

System run time, format last: minutes

1 user

Number of currently logged on users

Load average:0.06, 0.60, 0.48

System load, which is the average length of the task queue. The three values were 1 minutes, 5 minutes, and 15 minutes ago to the present average.

  2. Second to third behavioral process and CPU information

When there are multiple CPUs, the content may be more than two lines (the individual states of the process can refer to the PS command in detail). The contents are as follows:

tasks:29 Total

Total number of processes

1 Running

Number of processes that are running

Sleeping

Number of processes for sleep

0 stopped

Number of processes stopped

0 Zombie

Number of zombie processes

Cpu (s): 0.3% US

Percentage of CPU occupied by user space

1.0% Sy

Percentage of CPU consumed by kernel space

0.0% ni

CPU percentage of processes that have changed priority in user process space

98.7% ID

Percentage of idle CPU

0.0% WA

Percentage of CPU time waiting for input and output

0.0% hi

0.0% si

3.45th Behavior Memory information.

The contents are as follows:

MEM:191272K Total

Total Physical Memory

173656k used

Total amount of physical memory used

17616k Free

Total Free Memory

22052k buffers

Amount of memory to use as the kernel cache

SWAP:192772K Total

Total Swap Area

0k used

Total number of swap areas used

192772k Free

Total Free Swap Area

123988k Cached

The total amount of buffer swap area. The in-memory content is swapped out to the swap area and then swapped in to memory, but the used swap area has not been overwritten, which is the size of the swap area where the content already exists in memory . When the corresponding memory is swapped out again, it is no longer necessary to write to the swap area.

Two. Process information

Column Name

Meaning

Pid

Process ID

PPID

Parent Process ID

Ruser

Real User Name

Uid

User ID of the process owner

USER

User name of the process owner

GROUP

Group Name of Process owner

Tty

The terminal name of the startup process. Processes that are not started from the terminal are displayed as?

PR

Priority level

NI

Nice value. Negative values indicate high priority, positive values indicate low priority

P

Last CPU used, only meaningful in multi-CPU environment

%cpu

CPU time consumption percentage last updated to current

Time

Total CPU time used by the process, in seconds

time+

Total CPU time used by the process, Unit 1/100 sec

%MEM

Percentage of physical memory used by the process

VIRT

The total amount of virtual memory used by the process, in kilobytes. Virt=swap+res

SWAP

The size, in kilobytes, of the virtual memory that the process is using, swapped out.

Res

The size, in kilobytes, of the physical memory that the process used and was not swapped out. Res=code+data

CODE

The amount of physical memory the executable code occupies, in kilobytes

DATA

The amount of physical memory that is used by parts other than executable code (data segment + stack), in kilobytes

Shr

Shared memory size, in kilobytes

Nflt

Number of page faults

Ndrt

The number of pages that were modified the last time it was written to.

S

Process state.
d= non-disruptive sleep state
R= Run
S= Sleep
t= Tracking/Stopping
z= Zombie Process

COMMAND

Command name/command line

Wchan

If the process is sleeping, the system function name in sleep is displayed

Flags

Task Flag, reference sched.h

Three. command to use

Refer to the man Help documentation for more information. Here are some of the following:

Command format:

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

Parameter description:

D: Specifies the time interval between each two screen information refresh. Of course the user can use the s interactive command to change it.

P: Monitor only 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: Specify cumulative mode

S: Causes 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: Display the entire command line instead of just displaying the command name

In the display window of the top command, we can also enter the following letters for some interaction:

The help documentation is as follows:

Help for Interactive Commands-procps version 3.2.7

Window 1:def:cumulative mode Off. System:delay 4.0 secs; Secure mode Off.

Z,b Global: ' Z ' change color mappings; ' B ' disable/enable bold

L,t,m Toggle summaries: ' l ' load avg; ' t ' TASK/CPU stats; ' m ' Mem info

1,i Toggle SMP View: ' 1 ' single/separate states; ' I ' Irix/solaris mode

F,o. Fields/columns: ' F ' Add or remove; ' O ' Change display order

F or O. Select sort Field

<,>. Move sort field: ' < ' next Col left; ' > ' Next col Right

R,h. Toggle: ' R ' normal/reverse sort; ' H ' Show threads

C,i,s. Toggle: ' C ' cmd name/line; ' I ' idle tasks; ' S ' cumulative time

X, Y. Toggle Highlights: ' X ' sort field; ' Y ' running tasks

Z,b. Toggle: ' Z ' Color/mono; ' B ' bold/reverse (only if ' x ' or ' Y ')

U. Show Specific user only

N or #. Set Maximum tasks displayed

K,r Manipulate tasks: ' K ' kill; ' R ' Renice

D or S Set update interval

W Write configuration file

Q Quit

(Commands shown with '. ' Require a visible task display window)

Press ' h ' or '? ' for help with Windows,

H or? : Displays the help screen and gives 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: Change 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 Ms. 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 of average load and start time information. That shows the first row of shadows.

M: Toggles display memory information. The shadow memory line is displayed

T: Toggles display of process and CPU status information. The shadow CPU line is displayed

C: Toggle display command name and full command line. Displays the complete command. This feature is useful.

M: Sorts based on the size of the resident memory.

P: Sorts according to the percentage size of CPU usage.

T: Sort by Time/cumulative time.

W: Writes the current settings to the ~/.TOPRC file. This is the recommended way to write top configuration files.

Linux commands (9) 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.