您的位置:首页 > 理论基础 > 计算机网络

用NetHogs监控Linux每个进程的网络使用情况

2014-09-29 11:24 537 查看
㈠ 下载安装

准备环境:yum -y install libpcap-devel ncurses-devel
wget http://sourceforge.net/projects/nethogs/files/nethogs/0.8/nethogs-0.8.0.tar.gz/download
tar xvzf nethogs-0.8.0.tar.gz
cd nethogs
make && make install
㈡ 作用
有别于其他统计和监控网卡流量、NetHogs 有点特别、可以监控每个进程的网络带宽占用情况
㈢ 使用
该程序需要 root 权限,默认是监控 eth0 网卡 ,如果有多网卡的话就必须进行指定
使用方法:
nethogs
nethogs eth1
nethogs [option] eth0 eth1
nethogs [option] eth0 eth1 ppp0
sudo /usr/sbin/nethogs eth0
交互式控制指令:
m : Cycle between display modes (kb/s, kb, b, mb)
r : Sort by received.
s : Sort by sent.
q : Quit and return to the shell prompt.
常用的 option :
-d delay for refresh rate.
-h display available commands usage.
-p sniff in promiscious mode (not recommended).
-t tracemode.
-V prints Version info.

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息