On Linux (preferably in the command line), how can I view network usage per process?

I'm not interested in total bandwith usage, but rather in how it's split among processes.

  • 2
    nethogs might work for you – Der Hochstapler Jun 20 '16 at 12:44
  • Sorry, man. I missed the comment. @Oliver should have it.... – Diagon Jun 20 '16 at 16:01
  • @It don't matter. You made it an answer. Meaningless score points go to you. :) (The accepted checkmark remains to be Oliver's for the taking, should he choose to compete with you ;)) – PSkocik Jun 20 '16 at 16:06
  • Ok. Though frustratingly enough, they do have significance until you get to 200 points, because they block us from commenting! (200 points will put you over 100 on all the SE sites, which solves that irritation.) – Diagon Jun 20 '16 at 16:09
sudo apt-get install nethogs
sudo nethogs

From the man page:

NetHogs is a small 'net top' tool. Instead of breaking the traffic down per protocol or per subnet, like most such tools do, it groups band‐width by process - and does not rely on a special kernel module to be loaded. So if there's suddenly a lot of network traffic, you can fire up NetHogs and immediately see which PID is causing this, and if it' some kind of spinning process, kill it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.