Linux流量监控iftop工具nload详细解析

复制#!/bin/bash echo -n "which nic?流量监" read eth echo "the nic is "$eth echo -n "how much seconds:" read sec echo "duration is "$sec" seconds, wait please..." infirst=$(awk /$eth/{print $1 } /proc/net/dev |sed s/$eth://) outfirst=$(awk /$eth/{print $10 } /proc/net/dev) sumfirst=$(($infirst+$outfirst)) sleep $sec"s" inend=$(awk /$eth/{print $1 } /proc/net/dev |sed s/$eth://) outend=$(awk /$eth/{print $10 } /proc/net/dev) sumend=$(($inend+$outend)) sum=$(($sumend-$sumfirst)) echo $sec" seconds total :"$sum"bytes" aver=$(($sum/$sec)) echo "avrage :"$aver"bytes/sec" 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.
本文地址:http://www.bzuk.cn/news/356d8899555.html
版权声明
本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。