top命令的字段信息及交互命令

来源:互联网 发布:js设置时间弹出界面 编辑:程序博客网 时间:2024/04/29 12:53

1.字段信息

序号列名含义aPID进程idbPPID父进程idcRUSERReal user namedUID进程所有者的用户ideUSER进程所有者的用户名fGROUP进程所有者的组名gTTY启动进程的终端名。不是从终端启动的进程则显示为 ?hPR优先级iNInice值。负值表示高优先级,正值表示低优先级jP最后使用的CPU,仅在多CPU环境下有意义k%CPU上次更新到现在的CPU时间占用百分比lTIME进程使用的CPU时间总计,单位秒mTIME+进程使用的CPU时间总计,单位1/100秒n%MEM进程使用的物理内存百分比oVIRT进程使用的虚拟内存总量,单位kb。VIRT=SWAP+RESpSWAP进程使用的虚拟内存中,被换出的大小,单位kb。qRES进程使用的、未被换出的物理内存大小,单位kb。RES=CODE+DATArCODE可执行代码占用的物理内存大小,单位kbsDATA可执行代码以外的部分(数据段+栈)占用的物理内存大小,单位kbtSHR共享内存大小,单位kbunFLT页面错误次数vnDRT最后一次写入到现在,被修改过的页面数。wS进程状态。
D=不可中断的睡眠状态
R=运行
S=睡眠
T=跟踪/停止
Z=僵尸进程
xCOMMAND命令名/命令行yWCHAN若该进程在睡眠,则显示睡眠中的系统函数名zFlags任务标志,参考 sched.h

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

2.交互命令                         

Help for Interactive Commands - procps version 3.2.8

--交互命令标题版本
Window 1:Def: Cumulative mode Off.  System: Delay 3.0 secs; Secure mode Off.

--显示当前top窗口的一些摘要信息。top可以提供四个监控窗口,每个窗口可以进行不同的配置。



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

--全局变量。Z定义颜色配置,B定义黑体显示
  l,t,m     Toggle Summaries: 'l' load avg; 't' task/cpu stats; 'm' mem info

--统计信息区各类信息的显示开关。l 负载 、t 任务和cpu信息、m 内存信息 
  1,I       Toggle SMP view: '1' single/separate states; 'I' Irix/Solaris mode

--多处理器开关。1 分cpu显示/整体显示切换,I暂时未知



  f,o     . Fields/Columns: 'f' add or remove; 'o' change display order

--f 对字段信息的增删操作,显示关心的字段,删除多余的字段;o修改字段的显示顺序,比如将RES、CODE、DATA放在一起,方便查看
  F or O  . Select sort field

--F、O设定排序字段,这个功能比较鸡肋,可以使用<和>来代替
  <,>     . Move sort field: '<' next col left; '>' next col right

--排序字段左移或由移。< 使用当前排序字段左边的字段进行排序,>则相反
  R,H     . Toggle: 'R' normal/reverse sort; 'H' show threads

--R 升序/降序排序切换开关,H 显示线程
  c,i,S   . Toggle: 'c' cmd name/line; 'i' idle tasks; 'S' cumulative time

--c,显示命令行信息,很有用,比如显示java进程的启动信息;i,忽略闲置和僵死进程;S 切换到累计模式,累计模式什么作用未知
  x,y     . Toggle highlights: 'x' sort field; 'y' running tasks

--x,将排序字段高亮显示;y 将当前运行任务高亮显示(这两个命令得在彩色模式下才能发挥作用)
  z,b     . Toggle: 'z' color/mono; 'b' bold/reverse (only if 'x' or 'y')

--z 彩色模式/黑白模式切换开关;b 黑体/背光切换
  u       . Show specific user only

--u 查看指定用户的进程,输入为空的话则查看所有进程
  n or #  . Set maximum tasks displayed

--n 设置最多显示多少任务


  k,r       Manipulate tasks: 'k' kill; 'r' renice

--k 杀死进程;r 重设 nice值
  d or s    Set update interval

--d or s 设置刷新间隔,单位为秒,默认刷新间隔为3
  W         Write configuration file

--将当前配置写入到配置文件 ~/.toprc
  q         Quit

--q 退出
          ( commands shown with '.' require a visible task display window ) 
Press 'h' or '?' for help with Windows,
any other key to continue 


Help for Windows / Field Groups - "Current Window" =  1:Def 


. Use multiple windows, each with separate config opts (color,fields,sort,etc)
. The 'current' window controls the Summary Area and responds to your Commands
  . that window's task display can be turned Off & On, growing/shrinking others
  . with NO task display, some commands will be disabled ('i','R','n','c', etc)
    until a different window has been activated, making it the 'current' window
. You change the 'current' window by:  1) cycling forward/backward; 2) choosing
  a specific field group; or 3) exiting the color mapping screen
. Commands available anytime   -------------
    A       . Alternate display mode toggle, show Single / Multiple windows

--全屏/多屏模式切换开关
    G       . Choose another field group and make it 'current', or change now
              by selecting a number from:  1 =Def; 2 =Job; 3 =Mem; or 4 =Usr

--多屏间切换

. Commands requiring 'A' mode  -------------
    g       . Change the Name of the 'current' window/field group

--重命名窗口
 *  a , w   . Cycle through all four windows:  'a' Forward; 'w' Backward

--多屏间进行切换
 *  - , _   . Show/Hide:  '-' Current window; '_' all Visible/Invisible
  The screen will be divided evenly between task displays.  But you can make
  some larger or smaller, using 'n' and 'i' commands.  Then later you could:
 *  = , +   . Rebalance tasks:  '=' Current window; '+' Every window

--恢复默认显示。=只恢复当前窗口,+恢复所有窗口
              (this also forces the current or every window to become visible)


In 'A' mode, '*' keys are your essential commands.  Please try the 'a' and 'w'
commands plus the 'G' sub-commands NOW.  Press <Enter> to make 'Current' 

原创粉丝点击