centos6版本安装

1、安装依赖包

yum install ncurses* -y yum install libpcap* -y

2、下载源码包

wget   tar -zxvf v0.8.1.tar.gz cd 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