How To: Monitor Which Processes are Using Bandwidth in Linux

I was listening to some music from my (aging) NAS earlier via Rhythmbox and it started to skip and stutter, so I had a look at the System Monitor and my laptop’s sending and receiving around 100KB/Sec.. WTF? I’m thinking along the lines of that’s a bit high just to stream a mp3 – I wish I could see what processes are using the network card… so I did a little bit of searching and found that I could via a nifty little command line program called nethogs.

You can install nethogs from the standard universe repositories (in Ubuntu at least), and then fire it up with the line:

So for me, this meant running:

Which should give you output that looks something like this:
NetHogs Example Output

Now unfortunately, in the above output it’s stating that the kernel/scheduler is using the bandwidth (PID 0) which is fair enough as it’s getting the data from the CIFS share – but at least I can see what is NOT using the bandwidth, and then through a process of elimination can close down apps and keep an eye on the output until only one process is left which is eating up bandwidth, and then either accept the fact that it’s a hungry, hungry hippo or shut it down.

The version of Rhythmbox that ships with Ubuntu 10.10 was the culprit in my case – it’s just nom-ing to check that all the files still exist and stuff, and after leaving it for some time to “check”, it’s finally quietened down to negligible levels and the music has stopped skipping – Yay! =D

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.