linuxtcpdump

How can I have tcpdump write to file and standard output the appropriate data?


I want to have tcpdump write raw packet data into a file and also display packet analysis into standard output as the packets are captured (by analysis I mean the lines it displays normally when -w is missing). Can anybody please tell me how to do that?


Solution

  • Here's a neat way to do what you want:

    tcpdump -w - -U | tee somefile | tcpdump -r -
    

    What it does: