2 Star 1 Fork 2

Erasin / bashtools

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
netool-if-width.sh 675 Bytes
一键复制 编辑 原始数据 按行查看 历史
Erasin 提交于 2014-01-21 13:59 . netool speed
#!/bin/bash
# 网络带宽测量
INTERVAL="1" # update interval in seconds
if [ -z "$1" ]; then
echo
echo usage: $0 [network-interface]
echo
echo e.g. $0 eth0
echo
exit
fi
IF=$1
while true
do
R1=`cat /sys/class/net/$1/statistics/rx_bytes`
T1=`cat /sys/class/net/$1/statistics/tx_bytes`
sleep $INTERVAL
R2=`cat /sys/class/net/$1/statistics/rx_bytes`
T2=`cat /sys/class/net/$1/statistics/tx_bytes`
TBPS=`expr $T2 - $T1`
RBPS=`expr $R2 - $R1`
TKBPS=`expr $TBPS / 1024`
RKBPS=`expr $RBPS / 1024`
echo "TX $1: $TKBPS kb/s RX $1: $RKBPS kb/s"
done
Shell
1
https://gitee.com/erasin/bashtools.git
git@gitee.com:erasin/bashtools.git
erasin
bashtools
bashtools
master

搜索帮助