How to monitor network traffic on a Linux or Unix like OS

Sometimes it is necessary or useful to monitor network traffic on your computer. You can monitor all the connections going in and out of your computer.

=Console based= These programs run in terminal such as xterm

Logging type
Using netstat you can monitor every connection going in and out of your computer. This monitors all major protocols including tcp and udp, and every port. netstat is a standard Unix program, so it is likely installed.

netstat also displays unix connections are fairly useless. To display only tcp and udp connection. tcp       0      0 10.0.0.9:57053          71-95-19-141.stat:16359 ESTABLISHED tcp       0  19109 10.0.0.9:49249          5ac33076.bb.sky.c:52782 ESTABLISHED tcp       0      0 10.0.0.9:53874          catv54039CF5.pool:16628 ESTABLISHED tcp       0      0 10.0.0.9:37182          host86-140-193-28.:6881 ESTABLISHED tcp       0      0 10.0.0.9:45563          61-224-49-29.dyna:48227 ESTABLISHED tcp       0      0 10.0.0.9:47665          74.213.68.212:43837     ESTABLISHED
 * Execute: netstat -t -u
 * For displaying continuously
 * Execute: netstat -t -u -c
 * Output

For more details see: man netstat and Introduction to Netstat Tutorial

Top like
These programs that operates like top (Unix)


 * nethogs
 * shows a list of the top processes which use network bandwidth.
 * http://nethogs.sourceforge.net/


 * jnettop:
 * shows a list of the top connections
 * http://jnettop.kubs.info/wiki/


 * iftop:
 * shows a list of the top connections, with bandwidth bars
 * http://www.ex-parrot.com/~pdw/iftop/

=Graphical=


 * Ntop
 * http://www.ntop.org/ntop.html
 * Gentoo install: emerge ntop


 * Netactview
 * http://netactview.sourceforge.net

=See Also=
 * many other programs

From HowTo Wiki, a Wikia wiki.