Linux – Know network usage by applications

A few days back, the network monitor was showing very high download speed in my openSuSE 11.4… even though I had no downloads or browsers running. This got me worried and a search began to find out the applications using network. Here is what I did. Install “iftop” from the repos. Just like “top”, “iftop” lists out the applications by their network usage. The command is:
sudo /usr/sbin/iftop -i wlan0
“-i” is for interface to use, I was on the wifi network so used “wlan0′. To check network usage for LAN or Cable network, the interface most probably will be “eth0”. [/caption] You can use “p” to toggle ports. Here the port used by first application is 25747. We will use this port to find out the application which is using network with the command “lsof”.
vivek@linux-og8s:~/Misc/downloads> lsof -w -n -i tcp:25747
COMMAND   PID  USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME                                                                                                                                                                                                                     
java    32504 vivek   68u  IPv6 1231661      0t0  TCP 192.168.1.2:25747->85.118.229.164:vce (ESTABLISHED)        
Here below the “COMMAND” application name listed is “java”. Right now there is vuze running on my system which is downloading the latest openSuSE 12.1 DVD. This way you can check if there is some application using guzzling your network unnecessarily.