Anyone know an easy way to ask Linux to "display every internet packet to/from google chrome" or "display every internet packet to/from telnet process with PID 10275"?
The telnet example is not too useful, since I can just use wireshark or tcpdump to see all TCP conversations involving port 23. That and nobody uses telnet anymore. But sniffing all packets to/from complex applications which use many ports seems like a useful thing.
I found some related answers exploring different ways to corroborate ports and PIDs (or programs names) and such, but nothing about packets
- How to tie a network connection to a PID without using lsof or netstat?
- How I can get ports associated to the application that opened them?
- How to do like "netstat -p", but faster?
Looks like someone might have been willing to pay for this answer a while back:
NetHogs is useful for quickly seeing what programs are creating traffic over an interface, but it doesn't have a way to capture packets.
dtrace
to watch syscalls likewrite
,send
,sendto
, but AFAIKdtrace
hasn't made it to Linux. Perhaps you can use a similar syscall logging tool? – Elastic