3
1
I'm running the following version of tcpdump:
- tcpdump version 4.0.0
- libpcap version 1.0.0
I want to make tcpdump write to a file for each packet it captures. Currently, I could only see the captured packets if I quit tcpdump.
tcpdump -i em1 -w /tmp/pkts.pcap -s 1500
I need to quit to be able to open /tmp/pkts.pcap
- until then I assume tcpdump is buffering. Is there a way to make tcpdump write to the file immediately instead of buffering?
"there is -U option but it doesnt work in 4.0.0 i suppose" So I assume you tried it and it didn't do what you expected? (If you didn't try it, try it before supposing that it doesn't work.) – None – 2014-10-31T18:00:59.347
You probably could make it write to a file immediately, but the best case scenario is this: If you opened the file when
– ubiquibacon – 2011-04-21T00:52:38.917tcpdump
was still running you would not see the results that were written to the file after you opened it (closing and reopen the file would let you see more recent results). Worst case scenario is thattcpdump
takes complete control of the file and does not allow you access to read it untiltcpdump
has finished. If you cannot live with either of these scenarios then you may want to look at another (more robust) solution like Wireshark@typoking: thanks. wireshark would be better way.. So, no way to tweak tcpdump. there is -U option but it doesnt work in 4.0.0 i suppose.. – sudurais – 2011-04-21T03:13:04.590
You could try using the tail command in a separate session to view the growing log file: eg: tail -f logfilename – Linker3000 – 2011-04-21T06:18:09.003