Skip to content

Instantly share code, notes, and snippets.

@barkink
Created June 19, 2017 09:17
Show Gist options
  • Save barkink/1dcfdd9d1e8ba0a3531217c3760238b8 to your computer and use it in GitHub Desktop.
Save barkink/1dcfdd9d1e8ba0a3531217c3760238b8 to your computer and use it in GitHub Desktop.
Throughout.sh
#!/bin/bash
intervalo=1
info="/sys/class/net/"
cd $info
for interface in eth*
do
rx1=`cat $info$interface/statistics/rx_bytes`
tx1=`cat $info$interface/statistics/tx_bytes`
`sleep $((intervalo))s`
rx2=`cat $info$interface/statistics/rx_bytes`
tx2=`cat $info$interface/statistics/tx_bytes`
echo -n $interface
echo -n " ---- "
echo -n RX: $((($rx2-$rx1)/($intervalo*1024))) Kbps
echo -n TX: $((($tx2-$tx1)/($intervalo*1024))) Kbps \n
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment