If all of a sudden, your network slows down and you ‘know’ that the hardware devices are working fine, then there’s a good chance that it’s caused by software. It could simply be the download manager occupying most of your network’s bandwidth, or the operating system downloading its daily updates etc.
So under those circumstance, having the ability to know which programs are using the most of your network’s bandwidth is pretty useful. If this happens to you while using GNU/Linux (I’m using Ubuntu), then there’s a simple tool called ‘NetHogs’ that shows you processes/applications and their network usage in real-time, might be able to help you out.
It outputs details such as the speed a particular application is accessing your network (both upload and download speeds), the network interface it’s using, user ID, process ID etc so you can quickly find the sucker that’s eating your bandwidth ;-).
Then you can properly close or, if you suspect an application is misbehaving, then you can kill it by using the information that ‘NetHogs’ gives you as well.
You can install ‘NetHogs’ in Ubuntu 12.10 Quantal Quetzal, 12.04 Precise Pangolin, 11.10 Oneiric Ocelot, 11.04, 10.10 and 10.04 by entering the below command in your Terminal window.
sudo apt-get install nethogs
How to use it?
As you can see from the first screenshot, it’s a command-line based utility, but using it is pretty easy. For monitoring a certain network interface (device), please use it in the below format (you’ll need ‘sudo’ privileges for running it though).
sudo nethogs network-interface
Replace ‘network-interface’ with the interface ID of your network. For closing the utility, press ‘q’.
If you want to speed up the update intervals, then use it in the below format.
sudo nethogs -d 1 network-interface
Again change both ‘network-interface’ and ’1′ with the number of seconds that you want it to update the data.
Few examples …
If you use a network card, then you should use ‘eth0′ or if you use a Wi-Fi adapter, then use ‘wlan0′. For instance, since I have a Wi-Fi based network connection, for getting a list of applications that consume most of my network’s bandwidth, I’ll use the below command.
sudo nethogs wlan0
For updating those details once every second, I’ll use the below one instead.
sudo nethogs -d 1 wlan0
It has few other options, for that please refer to its manual by using the below command.
Another feature of ‘NetHogs’ is that, when the data flow is zero, it’ll still display applications based on their network bandwidth usage, when they were last active.
Well, that’s pretty much it. Enjoy!.