How to calculate network traffic by process on Linux?

Posted on

Problem :

I want to do something like this:

time my_application

But instead of time I want some utility that will measure the network traffic:

<some_network_tool> my_application

It should give some stats after my_application quits. I’m only interested in volumes (Kb, Mb, Gb) and not in contents.

Is there such an utility?

Solution :


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.

Fortunaltely, You have bunch of choices to do that, if you want:

  1. Overall bandwidth – nload, bmon, slurm, bwm-ng, cbm, speedometer, netload
  2. Overall bandwidth (batch style output) – vnstat, ifstat, dstat, collectl
  3. Bandwidth per socket connection – iftop, iptraf, tcptrack, pktstat, netwatch, trafshow
  4. Bandwidth per process – nethogs


Leave a Reply

Your email address will not be published. Required fields are marked *