Capture nethogs output in log file

You can use this command to capture output:

nethogs -d 5 | sed 's/[^[:print:][:cntrl:]]//g' > output.txt

You can run nethogs in background in tracemode and write output to a file like this:

sudo nethogs -t eth1 &> /var/tmp/nethogs.log & 

Download and build the nethogs-parser as described here.

Then after you have accumulated enough data you can run the parser to see the results:

./hogs -type=pretty /var/tmp/nethogs.log 

Make sure to kill the running nethogs process when you are done collecting data.

More info here on automating the task.


I dont know when these options got implemented but you can use nethogs -t or nethogs -b, the pid and user are strangely placed at the end of the pid command string, but easy enough to parse.

I think you need to use the latest cvs version 0.8.1-SNAPSHOT

Tags:

Linux

Bash