点击(此处)折叠或打开
- #!/bin/bash
- rx1=$(ifconfig $1|grep "RX bytes"|awk '{print $2}'|awk -F: '{print $2}')
- sleep 1
- rxa=$(($rx1 / 1000))
- rx2=$(ifconfig eth0|grep "RX bytes"|awk '{print $2}'|awk -F: '{print $2}')
- rxb=$(($rx2 / 1000))
- echo "Net Traffic is:" $(($rxb - $rxa))k/s
使用方法如下:
点击(此处)折叠或打开
- chmod 777 traffic
- watch ./traffic eth0