个人比较喜欢iftop,它能动态的用简单的ASC图标识网卡当前流量
首行是网络流量刻度,
中间是与其它机器的流量,有个白底的bar直观的标识流量变化,后三列数据分别表示:
1. preceding 2 seconds 过去两秒钟的流量(traffic)
2. around half that amount over the preceding 10s 过去十秒钟流量的一半
3. a fifth of that over the whole of the last 40s 过去40秒钟流量的五分之一
底下3行
TX:发送流量
RX:接收流量
TOTAL:总流量
cumm:运行iftop以来的总流量
peak:峰值流量
rates:分别表示过去 2s 10s 40s时间内网卡总的平均流量
按h可以得到帮助,从帮助回到流量图也是按h
按流量排序
http://www.ex-parrot.com/~pdw/iftop/download/iftop-0.17.tar.gz
# tar zvfx iftop-0.16.tar.tar
# cd iftop-0.16
# ./configure --prefix=/usr/local/iftop
# make && make install
# cp /usr/local/iftop/sbin/iftop /bin
3. 运行iftop
# iftop -i eth0 -n
查看ppp0网络接口的实时流量:
# iftop -i ppp0
以字节(bytes)为单位显示流量(预设是位bits):
# iftop -B
直接显示IP, 不进行DNS
反解:
# iftop -n
直接显示连接端口编号, 不显示服务名称:
# iftop -N
显示192.168.1.0网段进出封包流量
# iftop -F 192.168.1.0/24 (或192.168.1.0/255.255.255.0)
其它参数可下 iftop -h 看说明。
像top一样,进入iftop画面时, 可按 p 切换是否显示连接端口,n 切换显示IP或主机的domain name,N切换显示连接端口代号或名称,p暂停显示,b切换是否显示长条,B切换计算几秒内的平均流量,其它按键可以按h观看说明。
还可根据~/.iftoprc设定不同的变量方便今后直接引用。