关于linux:Linuxtop命令-–-实时显示系统运行状态

41次阅读

共计 5576 个字符,预计需要花费 14 分钟才能阅读完成。

语法格局:

top [参数]

罕用参数:

参数 释义
-d < 秒 > 扭转显示的更新速度
-c 切换显示模式
-s 平安模式,不容许交互式指令
-i 不显示任何闲置或僵死的行程
-n 设定显示的总次数,实现后将会主动退出
-b 批处理模式,不进行交互式显示
[root@VM-24-4-centos ~]# top
top - 14:22:52 up 123 days, 23:58,  1 user,  load average: 0.02, 0.06, 0.08
Tasks: 106 total,   1 running, 104 sleeping,   0 stopped,   1 zombie
%Cpu(s):  2.8 us,  2.0 sy,  0.0 ni, 95.0 id,  0.2 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  3880172 total,   711620 free,  2004244 used,  1164308 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  1607256 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                                                                                                                                                 
11375 clickho+  20   0 7306500 565992 267236 S   7.3 14.6   6:03.20 clickhouse-serv                                                                                                                                                                                         
23326 root      20   0  999664  58372  12812 S   1.3  1.5 255:01.36 YDService                                                                                                                                                                                               
 2408 mysql     20   0 1836864 631304   1768 S   0.3 16.3 296:22.75 mysqld                                                                                                                                                                                                  
 9526 root      20   0 3698216 431040      0 S   0.3 11.1  98:58.84 java                                                                                                                                                                                                    
20865 root      20   0  164900   9028   1536 S   0.3  0.2  24:50.25 barad_agent                                                                                                                                                                                             
20866 root      20   0 1204560  15384   2008 S   0.3  0.4 166:04.63 barad_agent                                                                                                                                                                                             
    1 root      20   0   51928   3668   2164 S   0.0  0.1  25:38.11 systemd                                                                                                                                                                                                 
    2 root      20   0       0      0      0 S   0.0  0.0   0:06.11 kthreadd                                                                                                                                                                                                
    4 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/0:0H                                                                                                                                                                                            
    6 root      20   0       0      0      0 S   0.0  0.0   4:43.22 ksoftirqd/0
………………省略局部输入信息………………
[root@VM-24-4-centos ~]# top -c
top - 14:28:48 up 124 days, 4 min,  1 user,  load average: 0.12, 0.09, 0.08
Tasks: 107 total,   1 running, 104 sleeping,   0 stopped,   2 zombie
%Cpu(s):  0.7 us,  0.8 sy,  0.0 ni, 98.5 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  3880172 total,   652504 free,  2012784 used,  1214884 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  1598216 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                                                                                                                                                 
11375 clickho+  20   0 7306500 573016 267236 S   1.3 14.8   6:19.54 /usr/bin/clickhouse-server --config=/etc/clickhouse-server/config.xml --pid-file=/run/clickhouse-server/clickhouse-server.pid                                                                           
23326 root      20   0  999664  58632  12812 S   1.0  1.5 255:05.63 /usr/local/qcloud/YunJing/YDEyes/YDService                                                                                                                                                              
 2408 mysql     20   0 1836864 631304   1768 S   0.3 16.3 296:23.51 /www/server/mysql/bin/mysqld --basedir=/www/server/mysql --datadir=/www/server/data --plugin-dir=/www/server/mysql/lib/plugin --user=mysql --log-error=VM-24-4-centos.err --open-files-limit=65535 --p+ 
 9526 root      20   0 3698216 431040      0 S   0.3 11.1  98:59.43 java -jar ruoyi-admin.jar --server.port=18081                                                                                                                                                           
27989 redis     20   0  165148   2532   1200 S   0.3  0.1  98:45.40 /www/server/redis/src/redis-server 0.0.0.0:6379                                                                                                                                                         
    1 root      20   0   51928   3668   2164 S   0.0  0.1  25:38.16 /usr/lib/systemd/systemd --switched-root --system --deserialize 22                                                                                                                                      
    2 root      20   0       0      0      0 S   0.0  0.0   0:06.11 [kthreadd]                                                                                                                                                                                              
    4 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 [kworker/0:0H]                                                                                                                                                                                          
    6 root      20   0       0      0      0 S   0.0  0.0   4:43.23 [ksoftirqd/0]                                                                                                                                                                                           
    7 root      rt   0       0      0      0 S   0.0  0.0   1:49.86 [migration/0]                                                                                                                                                                                           
    8 root      20   0       0      0      0 S   0.0  0.0   0:00.00 [rcu_bh]                                                                                                                                                                                                
    9 root      20   0       0      0      0 S   0.0  0.0 119:34.73 [rcu_sched]                                                                                                                                                                                             
   10 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 [lru-add-drain]                                                                                                                                                                                         
   11 root      rt   0       0      0      0 S   0.0  0.0   0:44.28 [watchdog/0]                                                                                                                                                                                            
   12 root      rt   0       0      0      0 S   0.0  0.0   0:40.17 [watchdog/1]                                                                                                                                                                                            
   13 root      rt   0       0      0      0 S   0.0  0.0   1:45.98 [migration/1]      
………………省略局部输入信息………………
[root@VM-24-4-centos ~]# top -b
top - 14:30:55 up 124 days, 6 min,  1 user,  load average: 0.21, 0.15, 0.11
Tasks: 106 total,   1 running, 104 sleeping,   0 stopped,   1 zombie
%Cpu(s):  3.1 us,  3.1 sy,  0.0 ni, 90.6 id,  0.0 wa,  0.0 hi,  3.1 si,  0.0 st
KiB Mem :  3880172 total,   640160 free,  2008788 used,  1231224 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  1602056 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 2408 mysql     20   0 1836864 631304   1768 S   6.7 16.3 296:23.78 mysqld
 3312 root      20   0       0      0      0 S   6.7  0.0   1:03.21 kworker/u4:2
    1 root      20   0   51928   3668   2164 S   0.0  0.1  25:38.18 systemd
    2 root      20   0       0      0      0 S   0.0  0.0   0:06.11 kthreadd
    4 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/0:0H
    6 root      20   0       0      0      0 S   0.0  0.0   4:43.24 ksoftirqd/0
    7 root      rt   0       0      0      0 S   0.0  0.0   1:49.86 migration/0
    8 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcu_bh
    9 root      20   0       0      0      0 S   0.0  0.0 119:34.83 rcu_sched
 ………………省略局部输入信息………………

top - 14:30:58 up 124 days, 6 min,  1 user,  load average: 0.19, 0.15, 0.11
Tasks: 106 total,   2 running, 103 sleeping,   0 stopped,   1 zombie
%Cpu(s):  0.8 us,  1.0 sy,  0.0 ni, 98.0 id,  0.2 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  3880172 total,   727748 free,  1920604 used,  1231820 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  1690160 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
11375 clickho+  20   0 7306500 482712 267236 S   3.0 12.4   6:25.50 clickhouse-serv
23326 root      20   0  999664  57756  12820 S   1.3  1.5 255:07.04 YDService
20866 root      20   0 1204560  15384   2008 S   0.7  0.4 166:06.87 barad_agent
    9 root      20   0       0      0      0 S   0.3  0.0 119:34.84 rcu_sched
    1 root      20   0   51928   3668   2164 S   0.0  0.1  25:38.18 systemd
    2 root      20   0       0      0      0 S   0.0  0.0   0:06.11 kthreadd
    4 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/0:0H
    6 root      20   0       0      0      0 S   0.0  0.0   4:43.24 ksoftirqd/0
    7 root      rt   0       0      0      0 S   0.0  0.0   1:49.86 migration/0
    8 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcu_bh
………………省略局部输入信息………………

top - 14:31:01 up 124 days, 7 min,  1 user,  load average: 0.19, 0.15, 0.11
Tasks: 106 total,   2 running, 103 sleeping,   0 stopped,   1 zombie
%Cpu(s):  3.0 us,  2.5 sy,  0.0 ni, 94.1 id,  0.3 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  3880172 total,   631760 free,  2015972 used,  1232440 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  1594708 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
11375 clickho+  20   0 7306500 577352 267236 S  10.0 14.9   6:25.80 clickhouse-serv
23326 root      20   0  999664  57756  12820 S   1.0  1.5 255:07.07 YDService
20866 root      20   0 1204560  15384   2008 S   0.7  0.4 166:06.89 barad_agent
 2408 mysql     20   0 1836864 631304   1768 S   0.3 16.3 296:23.79 mysqld
 9526 root      20   0 3698216 431040      0 S   0.3 11.1  98:59.61 java
20865 root      20   0  164900   9028   1536 S   0.3  0.2  24:50.56 barad_agent
26568 root      20   0 3510360 115652      0 S   0.3  3.0  29:36.64 java
27989 redis     20   0  165148   2532   1200 S   0.3  0.1  98:45.51 redis-server
    1 root      20   0   51928   3668   2164 S   0.0  0.1  25:38.18 systemd
    2 root      20   0       0      0      0 S   0.0  0.0   0:06.11 kthreadd
    4 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/0:0H
  ………………省略局部输入信息………………

top - 14:31:04 up 124 days, 7 min,  1 user,  load average: 0.18, 0.15, 0.11
Tasks: 106 total,   2 running, 103 sleeping,   0 stopped,   1 zombie
%Cpu(s):  0.8 us,  1.3 sy,  0.0 ni, 97.7 id,  0.2 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  3880172 total,   741248 free,  1906472 used,  1232452 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  1704228 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
11375 clickho+  20   0 7306500 467060 267236 S   1.0 12.0   6:25.83 clickhouse-serv
23326 root      20   0  999664  57756  12820 S   1.0  1.5 255:07.10 YDService
20866 root      20   0 1204560  15384   2008 S   0.7  0.4 166:06.91 barad_agent
    9 root      20   0       0      0      0 S   0.3  0.0 119:34.85 rcu_sched
 2408 mysql     20   0 1836864 631304   1768 S   0.3 16.3 296:23.80 mysqld
 9526 root      20   0 3698216 431040      0 S   0.3 11.1  98:59.62 java
27989 redis     20   0  165148   2532   1200 S   0.3  0.1  98:45.52 redis-server
    1 root      20   0   51928   3668   2164 S   0.0  0.1  25:38.18 systemd
    2 root      20   0       0      0      0 S   0.0  0.0   0:06.11 kthreadd
    4 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/0:0H
    ………………省略局部输入信息………………

正文完
 0