Retrieve process network usage (since restart, if neccessary) via Bash script
I've been hunting for a while on how to get the network usage of a process in Linux using a Bash script, but I've only found the same answers repeated over and over again.
It'd be nice if there was a way to programamatically retrieve t开发者_如何学编程he network usage of a process, instead of having some poor tech stare at a terminal 24/7 running an instance of ntop.
Does anyone know of a way to do this?
Thanks.
The only thing I've come across is:
cat /proc/PID/net/dev
However, it's not accurate and reports statistics from the whole system. (virtually identical to /proc/net/dev
精彩评论