ITPub博客

首页 > Linux操作系统 > Linux操作系统 > top命令浅析

top命令浅析

原创 Linux操作系统 作者:haha牛 时间:2013-04-01 20:23:32 0 删除 编辑
top命令用于动态综合监控linux系统情况
top - 18:59:08 up 10:13,  3 users,  load average: 0.04, 0.05, 0.01
Tasks:  84 total,   1 running,  83 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0% us,  0.2% sy,  0.0% ni, 99.8% id,  0.0% wa,  0.0% hi,  0.0% si
Mem:   1034536k total,   611476k used,   423060k free,    36408k buffers
Swap:  2096472k total,        0k used,  2096472k free,   485672k cached
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                         
 6640 root      15   0  8400 2600 2108 S  0.3  0.3   0:01.35 sshd                                                                                                                             
    1 root      16   0  1856  544  464 S  0.0  0.1   0:01.37 init                                                                                                                             
    2 root      RT   0     0    0    0 S  0.0  0.0   0:00.06 migration/0                                                                                                                      
    3 root      34  19     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/0                                                                                                                      
    4 root      RT   0     0    0    0 S  0.0  0.0   0:00.05 migration/1                                                                                                                      
    5 root      34  19     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/1                                                                                                                      
    6 root       5 -10     0    0    0 S  0.0  0.0   0:00.04 events/0                                                                                                                         
    7 root       5 -10     0    0    0 S  0.0  0.0   0:00.01 events/1                                                                                                                         
    8 root       6 -10     0    0    0 S  0.0  0.0   0:00.02 khelper                                                                                                                          
    9 root       7 -10     0    0    0 S  0.0  0.0   0:00.00 kthread                                                                                                                          
   10 root      15 -10     0    0    0 S  0.0  0.0   0:00.00 kacpid                                                                                                                           
   88 root       5 -10     0    0    0 S  0.0  0.0   0:00.00 kblockd/0                                                                                                                        
   89 root       5 -10     0    0    0 S  0.0  0.0   0:00.03 kblockd/1                                                                                                                        
   90 root      25   0     0    0    0 S  0.0  0.0   0:00.00 khubd                                                                                                                            
  107 root      20   0     0    0    0 S  0.0  0.0   0:00.00 pdflush                                                                                                                          
  108 root      15   0     0    0    0 S  0.0  0.0   0:01.03 pdflush                                                                                                                          
  109 root      25   0     0    0    0 S  0.0  0.0   0:00.00 kswapd0                                                                                                                          
  110 root       6 -10     0    0    0 S  0.0  0.0   0:00.00 aio/0                                                                                                                            
  111 root       6 -10     0    0    0 S  0.0  0.0   0:00.00 aio/1    
他是动态交互式命令   
输入h会弹出帮助信息
Help for Interactive Commands - procps version 3.2.3
Window 1:Def: Cumulative mode Off.  System: Delay 20.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,
any other key to continue
top中第一行中
top - 19:00:44 up 10:15,  3 users,  load average: 0.08, 0.04, 0.00
19:00:44  当前系统时间
up 10:15   系统从开机到现在运行的时长
3 users   目前系统中有3个用户登录
load average     分别代表过去1、5、15分钟的平均负载情况
top中第二行显示的是 当前的进程信息
Tasks:  84 total,   1 running,  83 sleeping,   0 stopped,   0 zombie
表示当前系统有84个进程,1个进程在运行,83处于sleep状态,0个stopped,0个僵死状态
top中第三行表示cpu使用情况(代表总体的使用情况)
Cpu(s):  0.1% us,  0.2% sy,  0.0% ni, 99.7% id,  0.0% wa,  0.0% hi,  0.0% si
用户进程使用了0.1%的cpu,系统进程使用了0.2%的cpu,改变过优先级的用户进程使用了0.0%的cpu,等待IO使用了0.0%的cpu,硬中断使用了0.0%的cpu,软中断使用了0.0%的cpu
top中第四行显示内存使用情况
Mem:   1034536k total,   612244k used,   422292k free,    36964k buffers
从内存大小为1034536k ,使用的为612244k ,空闲的为422292k ,其中用作缓存的为36964k
top中第五行显示的是交换区使用情况
Swap:  2096472k total,        0k used,  2096472k free,   485748k cached
交换区总大小为2096472k ,已经使用0k ,空闲2096472k ,用作cached的大小为485748k
接下来显示的是进程的情况
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
pid   进程号
user   进程的用户名
pr      进程优先级
ni      优先级号-20最高 19为最低
virt   进程使用虚拟内存的大小
res   进程使用物理内存大小
shr   进程使用共享内存大小
交互过程中f可以添加或减少显示项,u可以只显示指定用户的进程,d更改刷新时间间隔,c显示进程的完整名称,q退出

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/23655288/viewspace-757603/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: sar命令学习
下一篇: 理解index skip scan
请登录后发表评论 登录
全部评论

注册时间:2010-04-04

  • 博文量
    102
  • 访问量
    337075