Couple quick scripts to get current transfer rates on an interface in bash
###getRx.sh:
#!/bin/bash
get_ispeed(){ cat /sys/class/net/eth0/statistics/rx_bytes; }
s1=`get_ispeed`;
sleep 1s;
s2=`get_ispeed`;
d=$(($s2-$s1));
printf “%.3f kB/s\n” $(bc -l <<< "$d / 1000");
printf "%.3f Mb/s\n" $(bc -l <<< "($d / 1000) / 125");
###getTx.sh:
#!/bin/bash
get_ispeed(){ cat /sys/class/net/eth0/statistics/tx_bytes; }
s1=`get_ispeed`;
sleep 1s;
s2=`get_ispeed`;
d=$(($s2-$s1));
printf "%.3f kB/s\n" $(bc -l <<< "$d / 1000");
printf "%.3f Mb/s\n" $(bc -l <<< "($d / 1000) / 125");