加入收藏 | 设为首页 | 会员中心 | 我要投稿 瑞安网 (https://www.ruian888.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

Linux Top 命令解析 比较详细--转

发布时间:2021-02-06 01:29:21 所属栏目:Linux 来源:网络整理
导读:TOP是一个动态显示过程,即可以通过用户按键来不断刷新当前状态.如果在前台执行该命令,它将独占前台,直到用户终止该程序为止.比较准确的说,top命令提供了实时的对系统处理器的状态监视.它将显示系统中CPU最“敏感”的任务列表.该命令可以按CPU使用.内存使用和

???????The number of pages that have been modified since??they??were??last??written??to disk.???Dirty??pages??must??be written to disk before the corresponding physical memory location can be used for some other virtual page.

w: S??--??Process Status

???????The status of the task which can be one of:

?????????????'D' = uninterruptible sleep

?????????????'R' = running

?????????????'S' = sleeping

?????????????'T' = traced or stopped

?????????????'Z' = zombie

???????Tasks shown as running should be more properly thought of as 'ready to run'??--their??task_struct is simply represented on the Linux run-queue.??Even without a true SMP machine,you may see numerous tasks in this state??depending??on??top's delay interval and nice value.

x: Command??--??Command line or Program name

???????Display the command line used to start a task or the name of the associated program.??You toggle between command line and name with 'c',which is both??a??command-line option and an interactive command. When??you've??chosen??to display command lines,processes without a command line (like kernel threads) will be shown with only the program name??in??parentheses,as in this example:????????????????( mdrecoveryd ) Either??form??of??display is subject to potential truncation if it's too long to fit in this field's??current??width.???That??width??depends??upon??other??fields??selected,their order and the current screen width.

???????Note: The 'Command' field/column is unique,in that it is not fixed-width.??When displayed,this column will be allocated all remaining screen width (up??to??the maximum??512??characters)??to??provide for the potential growth of program names into command lines.

y: WCHAN??--??Sleeping in Function

???????Depending on the availability of the kernel link map ('System.map'),this??field will??show??the??name or the address of the kernel function in which the task is currently sleeping.??Running tasks will display a dash ('-') in this column.

???????Note: By displaying this field,top's own working set will be increased by??over 700Kb.???Your??only??means of reducing that overhead will be to stop and restart??????????top.

z: Flags??--??Task Flags

???????This column represents the task's current scheduling flags which??are??expressed in??hexadecimal??notation and with zeros suppressed.??These flags are officially documented in .??Less formal documentation can also be??found??on the 'Fields select' and 'Order fields' screens.

???????默认情况下仅显示比较重要的??PID、USER、PR、NI、VIRT、RES、SHR、S、%CPU、%MEM、TIME+、COMMAND??列。

2.1?用快捷键更改显示内容。(1)更改显示内容通过?f键可以选择显示的内容。

???????按?f?键之后会显示列的列表,按?a-z??即可显示或隐藏对应的列,最后按回车键确定。

(2)按o键可以改变列的显示顺序。

???????按小写的?a-z?可以将相应的列向右移动,而大写的?A-Z??可以将相应的列向左移动。最后按回车键确定。

???????按大写的?F?或?O?键,然后按?a-z?可以将进程按照相应的列进行排序。而大写的??R?键可以将当前的排序倒转。

???????设置完按回车返回界面。

三.??命令使用

详细内容可以参考MAN?帮助文档。这里列举部分内容:

命令格式:

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

参数说明:

d:??指定每两次屏幕信息刷新之间的时间间隔。当然用户可以使用s交互命令来改变之。

p:??通过指定监控进程ID来仅仅监控某个进程的状态。

q:该选项将使top没有任何延迟的进行刷新。如果调用程序有超级用户权限,那么top将以尽可能高的优先级运行。

S:?指定累计模式

s?:?使top命令在安全模式中运行。这将去除交互命令所带来的潜在危险。

i:??使top不显示任何闲置或者僵死进程。

c:??显示整个命令行而不只是显示命令名

在top命令的显示窗口,我们还可以输入以下字母,进行一些交互:

帮助文档如下:

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或者???:?显示帮助画面,给出一些简短的命令总结说明。

(编辑:瑞安网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读