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.Since NetHogs heavily relies on /proc, it currently runs on Linux only.
Install NetHogs on ubuntu
Preparing your system
First you need to install the following packages
sudo apt-get install libncurses5 libpcap0.8
Now install the nethogs using the following command
sudo apt-get install nethogs
nethogs [-d] [-h] [-p] [-t] [-V] [device(s)]
-d delay for refresh rate.
-h display available commands usage.
-p sniff in promiscious mode (not recommended).
sudo nethogs eth1
sudo nethogs -d 2 eth1