Cybersecurity-Mastery

Home › Cheatsheets › tcpdump Cheatsheet

tcpdump Cheatsheet

BPF expressions and capture recipes. Printable: use your browser's Print → Save as PDF.

Domain: Networking · Last updated 2026-08-12

Quick reference

This cheatsheet is a fast recall aid, not a tutorial — learn the concepts in the Manual, then keep this beside you while you work.

Essentials

CommandPurpose
tcpdump -DList interfaces
tcpdump -i eth0Capture on interface
tcpdump -i eth0 -w out.pcapWrite to file
tcpdump -r out.pcapRead a file
tcpdump -nnNo name/port resolution
tcpdump -A / -XASCII / hex+ASCII payload
tcpdump -c 100Stop after N packets
tcpdump -s 0Full packet (snaplen)

Filters (BPF)

text
tcpdump -i eth0 host 10.0.0.5
tcpdump -i eth0 net 10.0.0.0/24
tcpdump -i eth0 tcp port 443
tcpdump -i eth0 'tcp[tcpflags] & tcp-syn != 0'     # SYNs
tcpdump -i eth0 'port 53'                          # DNS
tcpdump -i eth0 'icmp'                             # pings
tcpdump -i eth0 src 10.0.0.5 and dst port 80

Combine with and / or / not. Rotate files: -G 3600 -w cap-%F-%H.pcap.

Cybersecurity-Mastery — interactive security learning · runs locally