3

Short question: In Ubuntu, how can I find out how much network data each process has used at a certain time interval (e.g., last hour, last day, ...)?

Long question: I am connecting my Ubuntu machine to the internet using a mobile data plan. After several hours of connection, the data usage is more than 2 GB, which is a bit more than expected. So I would like to find out where does the data go. Searching on the internet, I found several tools, for example, nethogs. But nethogs only tells me the instantaneous bandwidth each process is using, which I do not care. Is there a tool that tells me how much network data each process has used at a certain time interval (e.g., last hour, last day, ...)?

Any tool that only shows the instantaneous bandwidth usage does not help. The data-eating process may be active for only a short time period that I do not know, so it is hard to tell which moment to monitor.

Any tool that only shows the total data usage of the machine or an interface (e.g., eth0, wwan0, ...) does not help. I already have that information from the data package provider.

Thank you for any comments.

Nuno
  • 153
  • 6
  • The processes that use a lot of network may have been coming and going rapidly. For example, assume that some processes are spawned every ten seconds and these processes run for five or so seconds, use a lot of network bandwidth and then die. – FedKad Oct 11 '20 at 10:09
  • Thank you for the comment. Yes, that is why nethogs does not help. – Nuno Oct 11 '20 at 10:15
  • `dstat` mentioned at https://askubuntu.com/a/1230070/855322 seems to be promising. – FedKad Oct 11 '20 at 10:36
  • is this answering your question? – johncli Oct 11 '20 at 10:58
  • Thank you for the comment. The link mentions a dozen tools with various functions . Do you have a specific one in mind? – Nuno Oct 11 '20 at 11:18
  • Your high traffic may be UDP related. See this: https://unix.stackexchange.com/questions/197712 – FedKad Oct 11 '20 at 11:45
  • 2
    Does this answer your question? [How do I find out which process is eating up my bandwidth?](https://askubuntu.com/questions/2411/how-do-i-find-out-which-process-is-eating-up-my-bandwidth) – karel Oct 12 '20 at 02:55

1 Answers1

2

.....That would be nethogs

nethogs running with its default parameters will lead you to the conclusion that it is inadequate.

If you read the man pages, there are flags you can add that will give you your exact desired results (according to your statements).

sudo nethogs -v 3

WU-TANG
  • 2,931
  • 1
  • 9
  • 19