linux中利用nethogs查看哪些进程占用网络带宽

78 阅读1分钟

本文已参与「新人创作礼」活动,一起开启掘金创作之路。

centos6版本安装

1、安装依赖包

yum install ncurses* -yyum install libpcap* -y

2、下载源码包

wget  tar -zxvf v0.8.1.tar.gzcd nethogs-0.8.1/make && make install

示例

nethogs em1

结果如下

  TOTAL                                               39.792      32.149 KB/sec NetHogs version 0.8.1    PID USER     PROGRAM                    DEV        SENT      RECEIVED          1698 mysql    ../local/mysql/bin/mysqld  eth0      39.272      29.425 KB/sec   1903 root     ..memcached/bin/memcached  eth0       4.345       6.076 KB/sec    593 root     php                        eth0       0.454       1.061 KB/sec    585 root     php                        eth0       0.454       1.061 KB/sec    577 root     php                        eth0       0.454       1.048 KB/sec    566 root     php                        eth0       0.454       1.048 KB/sec      ? root     ..9:55262-100.67.92.33:80             0.171       0.121 KB/sec   2526 root     barad_agent                eth0       0.284       0.121 KB/sec   2095 root     /usr/local/php72/bin/php   eth0       0.893       0.114 KB/sec   2096 root     /usr/local/php72/bin/php   eth0       0.906       0.114 KB/sec   2094 root     /usr/local/php72/bin/php   eth0       0.883       0.114 KB/sec

可以看到哪个进程占用带宽

centos7版本安装

yum install nethogs

参考文献:www.phpmianshi.com/?id=256