Detailed parameters of linux top command of the top linux command arguments detailed

 

turn:

The top linux command arguments detailed

Brief introduction

top command is commonly used under Linux performance analysis tools, it can display real-time system resource usage status of each process, similar to Windows Task Manager.

top displays the current system processes and other conditions, is a dynamic display of process, that can be constantly refreshed by the user of the current state of the key. If you execute the command in the foreground, it will monopolize the front desk until the user terminates the program so far. more accurate to say , top command provides real-time status monitoring system processor it will show the system CPU the most "sensitive" task list command can be used in the CPU memory usage and execution time on the task of sorting;... and the command many features can be set by an interactive command or in personal customization file. 

The following detailed description of its use.

Parameter Meaning

Copy the code
Copy the code
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: 191272k total, 173656k used, 17616k free, 22052k buffers
Swap: 192772k total, 0k used, 192772k free, 123988k 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
Copy the code
Copy the code


Statistical information area before the five elements is the overall system statistics. The first line is the task queue information, the implementation of the results with the uptime command. Which reads as follows:

01:06:48 Current time 
up 1:22 system running time, format too: min
1 user currently logged on the number of users
load average: 0.06, 0.60, 0.48 system load, that is, the average length of the task queue. Three values were 1 minute, 5 minutes, 15 minutes prior to the current average.

 

Second, third acts of the information process and the CPU. When there are multiple CPU, these elements may be more than two lines. It reads as follows:

Copy the code
Copy the code
The total number of total process 
the number of processes running running 
sleeping the sleep of the number of processes 
several stopped to stop the process of 
zombie number of zombie 
Cpu (S): 
0.3% US user space CPU-percentage 
1.0% sy kernel space occupied by the percentage of CPU 
0.0% Ni user process space in the changed priorities of the process CPU percentage 
98.7% id idle CPU percentage 
percentage of 0.0% wa waiting for input and output of the CPU time 
0.0% hi: hardware CPU interrupts occupancy percentage of 
0.0% si: soft interrupt occupancy percentage of 
0.0% st: virtual machine occupancy percentage
Copy the code
Copy the code

 

 

The last two acts of memory information. It reads as follows:

Copy the code
Copy the code
MEM: 
191272k total amount of physical memory
total physical memory used 173656k used
17616k free amount of memory free
22052k buffers as the amount of memory the kernel cache
Swap:
total exchange area 192772k total
amount used swap 0k used
192772k free free swap total
amount 123988k cached buffer swap, the contents of memory to be swapped out to the swap, but later was changed into memory, but the used swap has not been covered, the value shall be the content already exists the size of the exchange zone in the memory, the corresponding memory can no longer be re-written to the switching zone swapped out.
Copy the code
Copy the code

 

Process information area below the area of ​​statistical information shows the details of each process. First, to understand what the meaning of each column.

Copy the code
Copy the code
No. Column name Meaning 
a PID process id
B PPIDs parent process id
C RUSER Real User name
User id of the process owner d UID
username e USER process owner
group name f GROUP process owner
g TTY terminal name to start the process. The process is not started from the terminal is displayed as?
H PR priority
i NI nice value. A negative value indicates a high priority, positive values indicate a low priority
CPU j P last used in a multi-CPU environment only meaningful
k% CPU last update to the current occupancy percentage of CPU time
CPU time used by the process total l TIME, in seconds
m tIME + total CPU time used by the process, the unit of 1/100 second
percentage of physical memory used by the process n% MEM
amount of virtual memory used by the process o VIRT unit kb. VIRT = SWAP + RES
virtual memory p SWAP process in use, to be swapped out the size, unit kb.
q RES used in the process, are not swapped out of physical memory size in kb. The DATA CODE + = the RES
R & lt executable code CODE occupied physical memory size, in kb
portion other than executable code s DATA (data segment + stack) occupied physical memory size, in kb
t SHR shared memory size in kB
U nFLT page number of errors
the last time v nDRT written up to now, been modified several pages.
w S process state (D = non-interrupted sleep, R = Run, S = sleep, T = trace / stop, Z = zombie process)
X the COMMAND command name / command line
y WCHAN if the process of sleep, the SLEEP the system function names
z flags task flags, reference sched.h
Copy the code
Copy the code
 

By default, display only the more important PID, USER, PR, NI, VIRT, RES, SHR, S,% CPU,% MEM, TIME +, COMMAND column. You can use the following shortcuts to change the display contents. 

Change the display content through  can choose to display the contents of a key. List f will appear after column, according to az you can show or hide the corresponding column, and finally press the Enter key OK. 
Press  o  key to change the display order of the columns. Lowercase az by the corresponding column can be shifted to the right, and can be uppercase AZ leftward corresponding column. Finally, press the Enter key OK. 
The uppercase  F  or  O  bond, then press az process can be sorted according to the corresponding column. And uppercase  R  bond can be inverted current sort.


Command

top use format

top [-] [d] [p] [q] [c] [C] [S] [s]  [n]


Parameter Description

Copy the code
Copy the code
d specified time interval between every two refresh the screen information. Of course, users can use the s interactive command to change it. 
p to only monitor the status of a process by specifying the monitoring process ID.
q This option will allow top to refresh without any delay. If the caller has superuser privileges, then the top will be the highest possible priority.
Accumulation mode designated S
s to make the top command operating in safe mode. This will remove potentially dangerous interactive command brings.
i so top does not show any idle or zombie processes.
c display command line rather than just display the command name
Copy the code
Copy the code


Other useful commands
Here are some interactive commands during the top command can be used. From the use of perspective, a skilled master these commands more important than the number of control options. These commands are single letter, if the s option on the command line options, some of which command may be blocked.

Copy the code
Copy the code
Ctrl + L erase and rewrite the screen. 
h or? Display help screen, the command is given a brief summary of some description.
k to terminate a process. The system will prompt the user to terminate the process PID, and process what kind of signal needs to be sent to. The termination process can generally use 15 signal; if you can not use it properly signal the end of 9 forcibly end the process. The default value is 15 signals. In the security mode command is shielded.
i Ignore idle and zombie processes. This is a switching command.
q to exit the program.
r re-arrange the priority of a process. The system prompts the user to change the process PID and the need to set the priority value. Enter a positive value will lower priority, otherwise the process can have a higher priority. The default value is 10.
S is switched to accumulation mode.
s change the delay time between two refreshes. The system will prompt the user to enter a new time, in s. If there is a decimal, it is converted into ms. Input 0 value, the system will continue to refresh, the default value is 5 s. Note that if the time setting is too small, it is likely to lead to constantly refresh, so no time to see the display case, and the system load will increase greatly.
f or F add or remove items from the current display.
O o or change the display order of the items.
l switch the display start time information and the average load.
m toggle display of memory information.
t switch the display process and CPU state information.
c switch the display name and full command line command.
M sorted according to the size of the resident memory.
P sorted according to size the percentage of CPU usage.
T are ordered according to time / cumulative time.
W Write current settings ~ / .toprc file. It is written top profile recommended method.
Copy the code
Copy the code

 

Attached to common operations:

top // every 5 seconds explicitly all processes of resource consumption 
top -d 2 // every 2 seconds explicit resource consumption of all processes
top -c // every 5 seconds explicit process of resource consumption, command-line parameters and display process (only the default process name)
Top -p 12345 -p 6789 // every 5 seconds display pid pid is 12345 and resource consumption are two processes of 6789
top -d 2 -c -p 123456 // display every 2 seconds pid is the process of resource usage 12345, and the process starts explicit command line parameters

 

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

Brief introduction

top command is commonly used under Linux performance analysis tools, it can display real-time system resource usage status of each process, similar to Windows Task Manager.

top displays the current system processes and other conditions, is a dynamic display of process, that can be constantly refreshed by the user of the current state of the key. If you execute the command in the foreground, it will monopolize the front desk until the user terminates the program so far. more accurate to say , top command provides real-time status monitoring system processor it will show the system CPU the most "sensitive" task list command can be used in the CPU memory usage and execution time on the task of sorting;... and the command many features can be set by an interactive command or in personal customization file. 

The following detailed description of its use.

Parameter Meaning

Copy the code
Copy the code
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: 191272k total, 173656k used, 17616k free, 22052k buffers
Swap: 192772k total, 0k used, 192772k free, 123988k 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
Copy the code
Copy the code


Statistical information area before the five elements is the overall system statistics. The first line is the task queue information, the implementation of the results with the uptime command. Which reads as follows:

01:06:48 Current time 
up 1:22 system running time, format too: min
1 user currently logged on the number of users
load average: 0.06, 0.60, 0.48 system load, that is, the average length of the task queue. Three values were 1 minute, 5 minutes, 15 minutes prior to the current average.

 

Second, third acts of the information process and the CPU. When there are multiple CPU, these elements may be more than two lines. It reads as follows:

Copy the code
Copy the code
The total number of total process 
the number of processes running running 
sleeping the sleep of the number of processes 
several stopped to stop the process of 
zombie number of zombie 
Cpu (S): 
0.3% US user space CPU-percentage 
1.0% sy kernel space occupied by the percentage of CPU 
0.0% Ni user process space in the changed priorities of the process CPU percentage 
98.7% id idle CPU percentage 
percentage of 0.0% wa waiting for input and output of the CPU time 
0.0% hi: hardware CPU interrupts occupancy percentage of 
0.0% si: soft interrupt occupancy percentage of 
0.0% st: virtual machine occupancy percentage
Copy the code
Copy the code

 

 

The last two acts of memory information. It reads as follows:

Copy the code
Copy the code
MEM: 
191272k total amount of physical memory
total physical memory used 173656k used
17616k free amount of memory free
22052k buffers as the amount of memory the kernel cache
Swap:
total exchange area 192772k total
amount used swap 0k used
192772k free free swap total
amount 123988k cached buffer swap, the contents of memory to be swapped out to the swap, but later was changed into memory, but the used swap has not been covered, the value shall be the content already exists the size of the exchange zone in the memory, the corresponding memory can no longer be re-written to the switching zone swapped out.
Copy the code
Copy the code

 

Process information area below the area of ​​statistical information shows the details of each process. First, to understand what the meaning of each column.

Copy the code
Copy the code
序号  列名    含义
a PID 进程id
b PPID 父进程id
c RUSER Real user name
d UID 进程所有者的用户id
e USER 进程所有者的用户名
f GROUP 进程所有者的组名
g TTY 启动进程的终端名。不是从终端启动的进程则显示为 ?
h PR 优先级
i NI nice值。负值表示高优先级,正值表示低优先级
j P 最后使用的CPU,仅在多CPU环境下有意义
k %CPU 上次更新到现在的CPU时间占用百分比
l TIME 进程使用的CPU时间总计,单位秒
m TIME+ 进程使用的CPU时间总计,单位1/100秒
n %MEM 进程使用的物理内存百分比
o VIRT 进程使用的虚拟内存总量,单位kb。VIRT=SWAP+RES
p SWAP 进程使用的虚拟内存中,被换出的大小,单位kb。
q RES 进程使用的、未被换出的物理内存大小,单位kb。RES=CODE+DATA
r CODE 可执行代码占用的物理内存大小,单位kb
s DATA 可执行代码以外的部分(数据段+栈)占用的物理内存大小,单位kb
t SHR 共享内存大小,单位kb
u nFLT 页面错误次数
v nDRT 最后一次写入到现在,被修改过的页面数。
w S 进程状态(D=不可中断的睡眠状态,R=运行,S=睡眠,T=跟踪/停止,Z=僵尸进程)
x COMMAND 命令名/命令行
y WCHAN 若该进程在睡眠,则显示睡眠中的系统函数名
z Flags 任务标志,参考 sched.h
Copy the code
Copy the code
 

默认情况下仅显示比较重要的 PID、USER、PR、NI、VIRT、RES、SHR、S、%CPU、%MEM、TIME+、COMMAND 列。可以通过下面的快捷键来更改显示内容。 

更改显示内容通过 键可以选择显示的内容。按 f 键之后会显示列的列表,按 a-z 即可显示或隐藏对应的列,最后按回车键确定。 
按 o 键可以改变列的显示顺序。按小写的 a-z 可以将相应的列向右移动,而大写的 A-Z 可以将相应的列向左移动。最后按回车键确定。 
按大写的 F 或 O 键,然后按 a-z 可以将进程按照相应的列进行排序。而大写的 R 键可以将当前的排序倒转。


命令使用

top使用格式

top [-] [d] [p] [q] [c] [C] [S] [s]  [n]


参数说明

Copy the code
Copy the code
d 指定每两次屏幕信息刷新之间的时间间隔。当然用户可以使用s交互命令来改变之。 
p 通过指定监控进程ID来仅仅监控某个进程的状态。
q 该选项将使top没有任何延迟的进行刷新。如果调用程序有超级用户权限,那么top将以尽可能高的优先级运行。
S 指定累计模式
s 使top命令在安全模式中运行。这将去除交互命令所带来的潜在危险。
i 使top不显示任何闲置或者僵死进程。
c 显示整个命令行而不只是显示命令名
Copy the code
Copy the code


其他实用命令
下面介绍在top命令执行过程中可以使用的一些交互命令。从使用角度来看,熟练的掌握这些命令比掌握选项还重要一些。这些命令都是单字母的,如果在命令行选项中使用了s选项,则可能其中一些命令会被屏蔽掉。

Copy the code
Copy the code
Ctrl+L 擦除并且重写屏幕。 
h或者? 显示帮助画面,给出一些简短的命令总结说明。
k 终止一个进程。系统将提示用户输入需要终止的进程PID,以及需要发送给该进程什么样的信号。一般的终止进程可以使用15信号;如果不能正常结束那就使用信号9强制结束该进程。默认值是信号15。在安全模式中此命令被屏蔽。
i 忽略闲置和僵死进程。这是一个开关式命令。
q 退出程序。
r 重新安排一个进程的优先级别。系统提示用户输入需要改变的进程PID以及需要设置的进程优先级值。输入一个正值将使优先级降低,反之则可以使该进程拥有更高的优先权。默认值是10。
S 切换到累计模式。
s 改变两次刷新之间的延迟时间。系统将提示用户输入新的时间,单位为s。如果有小数,就换算成m s。输入0值则系统将不断刷新,默认值是5 s。需要注意的是如果设置太小的时间,很可能会引起不断刷新,从而根本来不及看清显示的情况,而且系统负载也会大大增加。
f或者F 从当前显示中添加或者删除项目。
o或者O 改变显示项目的顺序。
l 切换显示平均负载和启动时间信息。
m 切换显示内存信息。
t 切换显示进程和CPU状态信息。
c 切换显示命令名称和完整命令行。
M 根据驻留内存大小进行排序。
P 根据CPU使用百分比大小进行排序。
T 根据时间/累计时间进行排序。
W 将当前设置写入~/.toprc文件中。这是写top配置文件的推荐方法。
Copy the code
Copy the code

 

附常用操作:

top // every 5 seconds explicitly all processes of resource consumption 
top -d 2 // every 2 seconds explicit resource consumption of all processes
top -c // every 5 seconds explicit process of resource consumption, command-line parameters and display process (only the default process name)
Top -p 12345 -p 6789 // every 5 seconds display pid pid is 12345 and resource consumption are two processes of 6789
top -d 2 -c -p 123456 // display every 2 seconds pid is the process of resource usage 12345, and the process starts explicit command line parameters

 

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

Guess you like

Origin www.cnblogs.com/libin6505/p/11270589.html