Check current network bandwidth used on a Linux/Unix box
Fri, 29 Nov 2013 14:10:30 +0000
Sometimes you need to quickly measure current bandwidth used by your Linux box and don't have dedicated command installed. You can use standard /proc/ file entries to get that info from the system.
Example of a embedded device with a TS stream as an input:
( cat /proc/net/dev; sleep 1; cat /proc/net/dev; ) | awk '/eth0/ { b=$1; sub(/eth0:/,"",b); if(bp){ print (b-bp)/1024/1024, "MB/s" }; bp=b }'
1.00053 MB/s