I'm looking for a permanently-running monitor which can emit a monthly (or daily, etc) bandwidth report, in a per-program manner. Example desired output:

Bandwidth consumption: last 30 days
Program     Downloaded   Uploaded
/usr/bin/ssh  30MB       100MB
/usr/bin/java 9000MB     3000MB

(it also could be per-process instead of per-program, but then I'd have to consolidate entries manually)

After significative research (including many similar questions over Stack Exchange), I still haven't found such a monitor. Maybe this is not possible under Linux. Or maybe this is bit of an unusual need.


2 Answers 2


Use nethogs -t to capture per-process usage and parse the output. From https://boopathi.in/blog/capturing-per-process-bandwidth-usage-using-nethogs/

sh -ic "{ /usr/sbin/nethogs -t eth1 &> output; \
kill 0; } | { sleep $TIMEOUT; \
kill 0; }" 3>&1 2>/dev/null

The output fields are:

Process / Process id / User id    sent kbps    recv kbps

and parse the output using https://github.com/boopathi/nethogs-parser

Another solution from SO: https://stackoverflow.com/a/20705080/3812704

But I like the first solution better.

  • Nethogs creates many files because I'm using ppp0 so I need to sum process usage in each file that is impossible for month. Is there any solution to do that for me? Nov 10, 2017 at 5:56
  • @Daniyal Please ask a new question and provide a nethogs sample output in it.
    – Dani_l
    Nov 10, 2017 at 10:49

You might want to accumulate and process the netstat or iptraf manually in some shell with manual sorting.

Most of the monitors in linux are runtime, some are enlisted here.

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.