How to monitor which application is consuming the network?

In Ubuntu I can see the total network usage from the 'System Monitor', but how do I know which application is consuming the network bandwidth? I would like to know the network consumption at a particular time per application.


Solution 1:

Command like nethogs can be used for the requirement. You can install it using sudo apt-get install nethogs from the command line.

NetHogs is a small 'net top' tool. Instead of breaking the traffic down per protocol or per subnet, like most tools do, it groups bandwidth by process. NetHogs does not rely on a special kernel module to be loaded. If there's suddenly a lot of network traffic, you can fire up NetHogs and immediately see which PID is causing this. This makes it easy to indentify programs that have gone wild and are suddenly taking up your bandwidth.