To monitor the instantaneous network usage, execute the ifstat command in bash. You may need to acquire it from a repository if you don’t have it already.
sudo apt-get install ifstat
To display usage on eth0, with a 5 second delay, just once:
ifstat -i eth0 5 1
You can change the number of seconds, and the number of times you want the output displayed. If you don’t specify the count, it will go on forever until you ctrl-c out of it.
So here is a script that displays the download rates in MB/s and upload rates in KB/s every 5 seconds until you hit ctrl-c.
while : do # Press ctrl-c to exit x=`ifstat -i eth0 5 1 | tail -1 | tr '\t' ' '`; #tail -1 takes the DL and UL speeds in KB/S x1=`echo $x | cut -d ' ' -f1`; x2=`echo $x | cut -d ' ' -f2`; x1=$(echo "scale=3; $x1/1024" | bc); # Convert DL rate to MB/S printf "D: %0.3f MB/s\t U: %0.3f KB/s\n" "$x1" "$x2" done

