Limit the packet count
Stop after 100 packets and save them to capture.pcap
tcpdump -i eth0 -c 100 -w capture.pcap
- tool
- tcpdump18 commands
More tcpdump commands
-
tcpdump -nn 'tcp[tcpflags] & (tcp-syn|tcp-ack) == tcp-syn'Catch only SYNs that open a connection (no SYN-ACK) to spot scans or SYN floods
-
tcpdump -nn 'tcp[tcpflags] & (tcp-syn|tcp-fin) != 0'Show only packets that open or close connections to track short-lived sessions
-
tcpdump -nn -i any host <ip> and not port 22Watch traffic to and from a host but hide your own SSH session
-
tcpdump -nn -s 0 -X -i any port <port>Show full packet bodies in hex and ASCII, -s 0 makes sure nothing is cut off
-
tcpdump -nn -i any -s 0 -C 100 -W 5 -w /tmp/cap.pcapRotate across 5 files of 100 MB each, so a long capture never fills the disk