linux 使用ifstat查看网络使用情况

首先安装ifstat

wget http://distfiles.macports.org/ifstat/ifstat-1.1.tar.gz
tar xzvf ifstat-1.1.tar.gz
cd ifstat-1.1
./configure
make
sudo make install

然后查看

#ifstat
  eth0       
 KB/s in  KB/s out
   12.64   1481.41
    0.00      0.00
   10.91   1459.28
    0.00      0.00
   15.71   1300.80
    0.00      0.00
   13.89   1615.13
    0.00      0.00
    9.53    696.94
    0.00      0.00
   12.72   1200.90

默认ifstat不监控回环接口,显示的流量单位是KB。

如果查看所有端口:

ifstat -a
        lo                 eth0                eth1       
 KB/s in  KB/s out   KB/s in  KB/s out   KB/s in  KB/s out
    0.08      0.08      0.00      0.00      0.00      0.00
    0.18      0.18     18.25   1286.86      0.00      0.00
    0.07      0.07      0.00      0.00      0.00      0.00
    0.07      0.07     17.33   1124.82      0.00      0.00
    0.07      0.07      0.00      0.00      0.00      0.00
    0.07      0.07     21.65   1149.00      0.00      0.00
    0.07      0.07      0.00      0.00      0.00      0.00
    0.17      0.17     19.84   1138.90      0.00      0.00
    0.25      0.25      0.00      0.00      0.00      0.00
    0.07      0.07     19.27   1630.61      0.00      0.00
    0.07      0.07      0.00      0.00      0.00      0.00
原文地址:https://www.cnblogs.com/liqiu/p/4497540.html