What is a simple & common command line tool to show network usage on a Linux machine?

i like ifstat:

brzoza:~# ifstat -b 1
       eth0                eth1                eth2       
 Kbps in  Kbps out   Kbps in  Kbps out   Kbps in  Kbps out
 7870.11  27165.49  24776.69   7626.12      0.00      0.00
 8738.48  27760.18  26787.02   7851.60      0.00      0.00
 8532.13  28028.55  26122.37   7850.08      0.00      0.00
 9029.12  25981.44  23108.86   8282.37      0.00      0.00

but there is much more - iptraf, iftop, nload just to name the few.

if you cannot really install / compile anything new - you'll have to write simple script parsing the output of ifconfig and calculating incements for input/output counters. two examples i've found: here and here.


Here are two tools that are worth checking out, although they are probably not available by default on your distribution :

  • nethogs : a simple tool that will display the network usage by process :

alt text
(source: sourceforge.net)

  • tcptrack is also very good, especially on a gateway - you can get the bandwidth used by any IP adress coming in or out your server :

alt text
(source: steve at www.rhythm.cx)

Tags:

Linux