6

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.

5
  • 2
    nethogs might work for you Commented Jun 20, 2016 at 12:44
  • Sorry, man. I missed the comment. @Oliver should have it....
    – Diagon
    Commented Jun 20, 2016 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 ;)) Commented Jun 20, 2016 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
    Commented Jun 20, 2016 at 16:09
  • related stackoverflow.com/questions/368002/… Commented Oct 29, 2017 at 2:05

1 Answer 1

5
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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .