#!/bin/bash iface="eth1" tbytes() { iface="$1" /sbin/ifconfig "$iface" | awk '/RX bytes/ { split($2, a, ":"); print a[2] }' } total_bytes_old="$(tbytes "$iface")" sleep 1 while true; do total_bytes="$(tbytes "$iface")" rate="$(echo "scale=2; ($total_bytes - $total_bytes_old)/1024" | bc)" echo "$rate KB/s" total_bytes_old=$total_bytes sleep 1 done