Skip to content

Instantly share code, notes, and snippets.

@fortitudepub
Created February 3, 2016 05:41
Show Gist options
  • Save fortitudepub/9ce92e8dbb62af916a7a to your computer and use it in GitHub Desktop.
Save fortitudepub/9ce92e8dbb62af916a7a to your computer and use it in GitHub Desktop.
calc if rx stats by shell script.
ifname=$1
let bytes1=0
while true; do
let bytes2=`ip -s link show $ifname | grep -A 1 RX | grep -v RX | awk '{print $1}'`
let diff=(bytes2 - bytes1)
let diff=(diff / 1024 / 1024)
echo "bandwitdth is $diff Mbps"
let bytes1=bytes2
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment