Linux命令(129)之dstat

简介: Linux命令(129)之dstat

linux命令之dstat

1.dstat介绍
linux命令dstat是用来实时显示系统中各个进程的资源占用情况

2.dstat用法
dstat [参数]

dstat参数
参数 说明
-c 显示CPU的相关信息
-d 显示磁盘的相关信息
-g 显示page相关的统计数据
-m 显示内存的相关统计数据
-n 显示网络的相关统计数据
-p 显示进程的相关统计数据
-r 显示io请求的相关的统计数据
-s 显示swap相关的统计数据
--tcp 启用tcp相关的统计数据
--udp 启用udp相关的统计数据
--raw 启用raw相关的统计数据
--socket 启用socket相关的统计数据
--top-cpu 显示最占用cpu的进程
--top-io 显示最占用io的进程
--top-mem 显示最占用内存的进程
3.实例
3.1.显示dstat的帮助信息
命令:

dstat -h

[root@centos79 ~]# dstat -h
Usage: dstat [-afv] [options..] [delay [count]]
Versatile tool for generating system resource statistics

Dstat options:
-c, --cpu enable cpu stats
-C 0,3,total include cpu0, cpu3 and total
-d, --disk enable disk stats
-D total,hda include hda and total
-g, --page enable page stats
-i, --int enable interrupt stats
-I 5,eth2 include int5 and interrupt used by eth2
-l, --load enable load stats
-m, --mem enable memory stats
-n, --net enable network stats
-N eth1,total include eth1 and total
-p, --proc enable process stats
-r, --io enable io stats (I/O requests completed)
-s, --swap enable swap stats
-S swap1,total include swap1 and total
-t, --time enable time/date output
-T, --epoch enable time counter (seconds since epoch)
-y, --sys enable system stats

--aio enable aio stats
--fs, --filesystem enable fs stats
--ipc enable ipc stats
--lock enable lock stats
--raw enable raw stats
--socket enable socket stats
--tcp enable tcp stats
--udp enable udp stats
--unix enable unix stats
--vm enable vm stats

--plugin-name enable plugins by plugin name (see manual)
--list list all available plugins

-a, --all equals -cdngy (default)
-f, --full automatically expand -C, -D, -I, -N and -S lists
-v, --vmstat equals -pmgdsc -D total

--bits force bits for values expressed in bytes
--float force float values on screen
--integer force integer values on screen

--bw, --blackonwhite change colors for white background terminal
--nocolor disable colors (implies --noupdate)
--noheaders disable repetitive headers
--noupdate disable intermediate updates
--output file write CSV output to file
--profile show profiling statistics when exiting dstat

delay is the delay in seconds between each update (default: 1)
count is the number of updates to display before exiting (default: unlimited)

[root@centos79 ~]#

3.2.实时显示系统中各个进程的资源占用情况
命令:

dstat

You did not select any stats, using -cdngy by default.
----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system--
usr sys idl wai hiq siq| read writ| recv send| in out | int csw
3 1 91 4 0 0| 434k 34k| 0 0 | 0 0 | 539 876
1 1 99 0 0 0| 0 0 | 12k 13k| 0 0 | 403 748
0 1 99 0 0 0| 0 0 |2482B 2938B| 0 0 | 334 694 ^C
[root@centos79 ~]#
3.3.显示cpu的相关信息
命令:

dstat -c

[root@centos79 ~]# dstat -c
----total-cpu-usage----
usr sys idl wai hiq siq
3 1 91 4 0 0
0 1 99 0 0 0
0 0 100 0 0 0
1 0 99 0 0 1^C
[root@centos79 ~]#
3.4.显示内存的相关信息
命令:

dstat -m

[root@centos79 ~]# dstat -m
------memory-usage-----
used buff cach free
7118M 1176k 1383M 1477M
7118M 1176k 1383M 1477M
7118M 1176k 1383M 1477M^C
[root@centos79 ~]#
3.5.显示page相关的统计数据
命令:

dstat -g

[root@centos79 ~]# dstat -g
---paging--
in out
0 0
0 0
0 0
0 0 ^C
[root@centos79 ~]#
3.6.显示磁盘相关的统计数据
命令:

dstat -d

[root@centos79 ~]# dstat -d
-dsk/total-
read writ
415k 33k
0 0
0 0 ^C
[root@centos79 ~]#
3.7.显示网络相关的统计数据
命令:

dstat -n

[root@centos79 ~]# dstat -n
-net/total-
recv send
0 0
1476B 1802B
16k 16k
1476B 1754B
2482B 2746B^C
[root@centos79 ~]#
3.8.显示进程相关的统计数据
命令:

dstat -p

[root@centos79 ~]# dstat -p
---procs---
run blk new
0 0 1.5
0 0 0
0 0 0
0 0 0^C
[root@centos79 ~]#
3.9.显示io请求相关的统计数据
命令:

dstat -r

[root@centos79 ~]# dstat -r
--io/total-
read writ
10.2 2.04
0 0
0 0
0 0 ^C
[root@centos79 ~]#
3.10.显示swap相关的统计数据
命令:

dstat -s

[root@centos79 ~]# dstat -s
----swap---
used free
0 3072M
0 3072M
0 3072M
0 3072M^C
[root@centos79 ~]#
3.11.启用tcp的统计数据
命令:

dstat --tcp

[root@centos79 ~]# dstat --tcp
----tcp-sockets----
lis act syn tim clo
35 28 0 0 0
35 28 0 0 0
35 28 0 0 0^C
[root@centos79 ~]#
3.12.启用udp的统计数据
命令:

dstat --udp

[root@centos79 ~]# dstat --udp
--udp--
lis act
10 0
10 0
10 0
10 0^C
[root@centos79 ~]#
3.13.启用raw的统计数据
命令:

dstat --raw

[root@centos79 ~]# dstat --raw
raw
raw
0
0
0
0^C
[root@centos79 ~]#
3.14.启用socket的统计数据
命令:

dstat --socket

[root@centos79 ~]# dstat --socket
------sockets------
tot tcp udp raw frg
3 46 7 0 0
3 46 7 0 0
3 46 7 0 0
3 46 7 0 0^C
[root@centos79 ~]#
3.15.显示最占用 cpu 的进程
命令:

dstat --top-cpu

[root@centos79 ~]# dstat --top-cpu
-most-expensive-
cpu process
java 1.4
java 1.0
node 0.5^C
[root@centos79 ~]#
3.16.显示最占用 io 的进程
命令:

dstat --top-io

[root@centos79 ~]# dstat --top-io
----most-expensive----
i/o process
bash 278k 7109B
java 133k 932B
java 2806B 0
vmtoolsd 11k 0 ^C
[root@centos79 ~]#
3.17.显示最占用内存的进程
dstat --top-mem

[root@centos79 ~]# dstat --top-mem
--most-expensive-
memory process
java 4535M
java 4535M
java 4535M^C

————————————————
版权声明:本文为CSDN博主「小黑要上天」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/z19861216/article/details/134499273

目录
相关文章
|
2月前
|
监控 Linux 网络安全
Linux命令大全:从入门到精通
日常使用的linux命令整理
608 13
|
3月前
|
Linux 网络安全 数据安全/隐私保护
使用Linux系统的mount命令挂载远程服务器的文件夹。
如此一来,你就完成了一次从你的Linux发车站到远程服务器文件夹的有趣旅行。在这个技术之旅中,你既探索了新地方,也学到了如何桥接不同系统之间的距离。
394 21
|
3月前
|
JSON 自然语言处理 Linux
linux命令—tree
tree是一款强大的Linux命令行工具,用于以树状结构递归展示目录和文件,直观呈现层级关系。支持多种功能,如过滤、排序、权限显示及格式化输出等。安装方法因系统而异常用场景包括:基础用法(显示当前或指定目录结构)、核心参数应用(如层级控制-L、隐藏文件显示-a、完整路径输出-f)以及进阶操作(如磁盘空间分析--du、结合grep过滤内容、生成JSON格式列表-J等)。此外,还可生成网站目录结构图并导出为HTML文件。注意事项:使用Tab键补全路径避免错误;超大目录建议限制遍历层数;脚本中推荐禁用统计信息以优化性能。更多详情可查阅手册mantree。
linux命令—tree
|
1月前
|
监控 Linux Shell
linux命令
常用 Linux 命令汇总
|
3月前
|
监控 Linux
Linux系统中使用df命令详解磁盘使用情况。
`df`命令是Linux系统管理员和用户监控和管理磁盘空间使用的重要工具。掌握它的基本使用方法和选项可以帮助在必要时分析和解决空间相关问题。简洁但功能丰富,`df`命令确保了用户可以快速有效地识别和管理文件系统的空间使用情况。
206 13
|
3月前
|
Unix Linux
linux命令—cd
`cd` 命令是 Linux/Unix 系统中用于切换工作目录的基础命令。支持相对路径与绝对路径,常用选项如 `-L` 和 `-P` 分别处理符号链接的逻辑与物理路径。实际操作中,可通过 `cd ..` 返回上级目录、`cd ~` 回到家目录,或利用 `cd -` 在最近两个目录间快速切换。结合 Tab 补全和 `pwd` 查看当前路径,能显著提升效率。此外,需注意特殊字符路径的正确引用及脚本中绝对路径的优先使用。
|
3月前
|
Linux
Linux命令拓展:为cp和mv添加进度显示
好了,就这样,让你的Linux复制体验充满乐趣吧!记住,每一个冷冰冰的命令背后,都有方法让它变得热情起来。
224 8
|
2月前
|
Linux C++
每天一个linux命令(8):cp 命令
cp 命令是 Linux 中用于复制文件或目录的命令。它的名字来源于英文单词 copy。这个命令非常常用,特别是在需要备份文件或创建文件副本时。
67 0
|
4月前
|
Ubuntu 搜索推荐 Linux
详解Ubuntu的strings与grep命令:Linux开发的实用工具。
这就是Ubuntu中的strings和grep命令,透明且强大。我希望你喜欢这个神奇的世界,并能在你的Linux开发旅程上,通过它们找到你的方向。记住,你的电脑是你的舞台,在上面你可以做任何你想做的事,只要你敢于尝试。
251 32
|
3月前
|
安全 Linux 定位技术
Linux环境下必备的基础命令概览
以上就是Linux系统中的基本命令和工具,掌握它们就能帮你在Linux世界里游刃有余。这其实就像是学习驾驭一辆新车,熟悉了仪表盘,调整好了座椅,之后的旅程就只需要享受风驰电掣的乐趣了。
83 4