Last active
August 18, 2017 17:33
-
-
Save marcobazzani/c200da3de3e6e8b33c2ca7952b5137d1 to your computer and use it in GitHub Desktop.
rx speed all networks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
for a in `ls -1 /sys/class/net/` | |
do | |
declare pre_${a}_rxbytes=`cat /sys/class/net/$a/statistics/rx_bytes` | |
declare pre_${a}_txbytes=`cat /sys/class/net/$a/statistics/tx_bytes` | |
done | |
while true | |
do | |
sleep 1 | |
for a in pppoe0 | |
do | |
declare post_${a}_rxbytes=`cat /sys/class/net/$a/statistics/rx_bytes` | |
declare post_${a}_txbytes=`cat /sys/class/net/$a/statistics/tx_bytes` | |
echo speed $a Down: $[ (post_${a}_rxbytes - pre_${a}_rxbytes)*8/1024/1024 ] Up: $[ (post_${a}_txbytes - pre_${a}_txbytes)*8/1024/1024 ] | |
declare pre_${a}_rxbytes=`cat /sys/class/net/$a/statistics/rx_bytes` | |
declare pre_${a}_txbytes=`cat /sys/class/net/$a/statistics/tx_bytes` | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment