Haui's bytes

news, diary, journal, whatever

Bandwidth monitors

There are many tools available, that allow you to monitor (among other things) the current downstream of your internet connection. Some of them, like dstat and bwm-ng are handy console applications, whereas others integrate nicely into your desktop. Two popular examples for this would be conky or gkrellm. So, in general there’s no real need for the following bash one-liner, unless you’re just an ordinary user working on some poorly equipped linux box which doesn’t offer any of the tools mentioned above. In that case, you’ll be glad to have a dirty solution like the following available:

r=$(cat /sys/class/net/eth0/statistics/rx_bytes) ; while [ 1 ]; do n=$(cat /sys/class/net/eth0/statistics/rx_bytes); d=$(((n-r) / 1024 ));r=$n; echo "$d KB/s"; sleep 1;done

There is no need to mention,that eth0 must be replaced by your primary interface’s name.