Daily Archives: August 14, 2018

Get Interface Speed In Linux Using Shell Script

Following is the shell script you can use to check the current throughput of network interface #!/bin/bash var=0 interface=”eth0″ while [ $var -eq 0 ] do tx=`cat /sys/class/net/$interface/statistics/tx_bytes` rx=`cat /sys/class/net/$interface/statistics/rx_bytes` sleep 1s tx1=`cat /sys/class/net/$interface/statistics/tx_bytes` rx1=`cat /sys/class/net/$interface/statistics/rx_bytes` txw=`expr $tx1 – $tx` rxw=`expr $rx1 – $rx` echo “$txw:$rxw” | cat > /home/speed.txt done Please check $interface variable

Read More