Skip to content
Advertisement

How to monitor all network traffic from a specific process in linux?

I want to monitor and log all traffic that a specific process produces.

I know about tcpdump, but it seems it doesn’t support filtering by process (pid/path, or at least user).

It there any other way to log all traffic from a process? Ideally I should be able to filter ports as well.

Thanks!

Advertisement

Answer

You should use strace command:

strace -o /tmp/network.out -e trace=network -fp <PID>
5 People found this is helpful
Advertisement