Have you ever been in Linux and wanted to watch how much bandwidth was going in and out of your box? Most have, and here’s a very simply way to do it without a GUI or installing anything extra:
# watch -n1 "ifconfig eth0 | grep Mb"
RX bytes:105209490 (100.3 Mb) TX bytes:448524558 (427.7 Mb)
What you end up with is a counter of your current bandwidth usage that gets updated every second. It’s not sexy but it gives you a decent feel for how much action your NIC is seeing.Just change your network interface in the
grep bit to the one you want and you’re all set. Oh, and if you’re using Debian or Ubuntu, you may want to try grepping for “Mib” instead of “Mb”.
Enjoy.:
tcpdump Primerlsof Primerfind and xargstr CommandCopyright © | Daniel Miessler | 1999-2008 | All Rights Reserved

Thanks. But is it not easier to add a bandwidth monitor to one’s Gnome panel?
Comment by Aleksandersen — 11/15/2006 @ 2:53 am
I have been using bwm-ng (http://www.gropp.org/?id=projects&sub=bwm-ng) but I’ll give your command a try.
Comment by Iain — 11/15/2006 @ 4:30 am
I believe the point was to be able to monitor network activity without installing anything.
Personally, I prefer using the -s switch to ifconfig, like so:
$ watch -n1 ifconfig -s eth0
…which outputs something like this:
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg eth0 1500 0 104129 0 0 0 107071 0 0 0 BMRU
…but it’s in a mono space font so all the columns line up.
Comment by Tim — 11/15/2006 @ 5:30 am
for Debian (at least for Debian etch) that should be MiB
Comment by birlinn — 11/16/2006 @ 1:09 pm
Thanks, I should have mentioned that. :)
Comment by Daniel Miessler — 11/16/2006 @ 1:12 pm