Linux命令(128)之vmstat

linux命令之vmstat

1.vmstat介绍

linux命令vmstat是用来显示系统中各个进程的资源占用情况

2.vmstat用法

vmstat [参数]

|----|----------|
| 参数 | 说明 |
| -s | 显示内存统计数据 |
[vmstat参数]

3.实例

3.1.显示内存统计数据

命令:

vmstat -s

复制代码
[root@logstash yum.repos.d]# vmstat -s
      4026160 K total memory
       244316 K used memory
       211152 K active memory
        92764 K inactive memory
      3495968 K free memory
         2632 K buffer memory
       283244 K swap cache
      4063228 K total swap
            0 K used swap
      4063228 K free swap
          614 non-nice user cpu ticks
            0 nice user cpu ticks
          918 system cpu ticks
      1519638 idle cpu ticks
          747 IO-wait cpu ticks
            0 IRQ cpu ticks
           27 softirq cpu ticks
            0 stolen cpu ticks
       201068 pages paged in
       108886 pages paged out
            0 pages swapped in
            0 pages swapped out
       293432 interrupts
       467671 CPU context switches
   1700206917 boot time
         1828 forks
[root@logstash yum.repos.d]# 

3.2.每隔2秒钟进行一次监控

命令:

vmstat 2

输入Ctrl+C退出

复制代码
[root@logstash yum.repos.d]# vmstat 2
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 1  0      0 3496100   2632 283248    0    0    13     7   19   31  0  0 100  0  0
 0  0      0 3496076   2632 283248    0    0     0     0   57   96  0  0 100  0  0
 0  0      0 3496076   2632 283248    0    0     0     1   44   84  0  0 100  0  0
 0  0      0 3496076   2632 283248    0    0     0     0   58   98  0  0 100  0  0
^C
[root@logstash yum.repos.d]# 

vmstat输出每一列的解释,如下:

procs:

r:等待运行的进程个数。CPU上等待运行的任务队列长度

b:处于不可中断睡眠态的进程个数。被阻塞的任务队列长度

memory:

swpd:交换内存使用总量

free:空闲的物理内存总量

buffer:用于 buffer 的内存总量

cache:用于 cache 的内存总量

swap:

si:数据进入swap中的数据速率

so:数据离开swap的速率

io:

bi:从块设备读入数据到系统的速度

bo:保存数据至块设备的速率

system:

in:中断速率

cs:上下文,切换的速率

cpu:

us:user space

sy:system

id:idle

wa:wait

st:stolen

3.3.显示vmstat帮助信息

命令:

vmstat -h

复制代码
[root@logstash yum.repos.d]# vmstat -h

Usage:
 vmstat [options] [delay [count]]

Options:
 -a, --active           active/inactive memory
 -f, --forks            number of forks since boot
 -m, --slabs            slabinfo
 -n, --one-header       do not redisplay header
 -s, --stats            event counter statistics
 -d, --disk             disk statistics
 -D, --disk-sum         summarize disk statistics
 -p, --partition <dev>  partition specific statistics
 -S, --unit <char>      define display unit
 -w, --wide             wide output
 -t, --timestamp        show timestamp

 -h, --help     display this help and exit
 -V, --version  output version information and exit

For more details see vmstat(8).
[root@logstash yum.repos.d]# 

3.4.显示vmstat版本信息

命令:

vmstat -V

复制代码
[root@logstash yum.repos.d]# vmstat -V
vmstat from procps-ng 3.3.10
[root@logstash yum.repos.d]# 
相关推荐
大梦想家~2 分钟前
在职牛马,因为考过阿里云ACP,浅说下一次过的强度
运维·云计算·网络工程师·阿里云acp·云计算工程师·阿里云acp考试·阿里云acp备考
2501_926978338 分钟前
分形时空理论框架:从破缺悖论到意识宇宙的物理学新范式引言(理论概念版)--AGI理论系统基础1.1
java·服务器·前端·人工智能·经验分享·agi
leo_23235 分钟前
IP--SMP(软件制作平台)语言基础知识之六十四
服务器·开发语言·tcp/ip·企业信息化·smp(软件制作平台)·应用系统·eom(企业经营模型)
暴力求解39 分钟前
Linux-进程(三)进程的孤儿状态和僵尸状态
linux·运维·服务器
乾元43 分钟前
数据投毒:如何通过训练数据污染埋下“后门”
运维·人工智能·网络协议·安全·网络安全·系统架构·自动化
小鸡食米1 小时前
Keepalived高可用
运维·服务器·网络
dreams_dream1 小时前
docker清除所有网络
运维·docker·容器
承渊政道1 小时前
Linux系统学习【深入剖析Git的原理和使用(下)】
linux·服务器·git·学习·gitee·vim·gitcode
The森1 小时前
Linux IO 模型纵深解析 06:IO 多路转接与多路复用的内核全链路实现
linux·服务器
敲上瘾1 小时前
从虚拟地址到物理页框:Linux 页表与内存管理全解析
linux·运维·服务器·缓存