tcpdump Cheat Sheet
Capture and inspect packets — filters, captures on a port/host, and the summary stats that find the smoking gun.
Troubleshooting3 sections · 22 commands
⌘K
Capturing
9tcpdump -i eth0Capture on an interface
tcpdump -i anyAny interface
tcpdump -c 50 -i eth0Stop after 50 packets
tcpdump -w capture.pcapWrite to a file
tcpdump -r capture.pcapRead a pcap file
tcpdump -i eth0 -nnNo name resolution
tcpdump -i eth0 -APrint ASCII payload (HTTP inspect)
tcpdump -i eth0 -XHex + ASCII dump
tcpdump -i eth0 -s 0Snapshot full packets (no truncation)
Filters
9tcpdump -i any port 443Any traffic on 443
tcpdump -i any tcp port 22TCP on port 22
tcpdump -i any host 10.0.0.5To or from a host
tcpdump -i any src 10.0.0.5From a source only
tcpdump -i any dst port 53 or port 80Boolean expressions
tcpdump -i any 'tcp[tcpflags] & tcp-syn != 0'Only SYN packets
tcpdump -i any udp port 53DNS over UDP
tcpdump -i any portrange 8000-8005A range of ports
tcpdump -i any ether proto ipv6Protocol-level filters
Stats & Analysis
4tcpdump -G 60 -w '%Y%m%d%H%M.pcap' -i eth0Rotate capture every 60s
tcpdump -nn -i any | grep -oE 'Flags \[[A-Z\.]+\]' | sort | uniq -cCount TCP flags seen
tcpdump -q -i eth0Quiet low-level output
capinfos capture.pcapMetadata about a capture (wireshark)