tcpdump advanced (advanced)

Advanced tcpdump: capture, filter, and analyze network traffic.

low risk

interactive breakdown — edit the command and press Explain
$ 
What it does

tcpdump captures network packets and displays or saves them for analysis. Beyond basic capture, it supports BPF filter expressions to target specific hosts, ports, or protocols. Captured files in pcap format can be analyzed in Wireshark.

Common flags
FlagMeaning
-iInterface to capture on
-wWrite to pcap file
-rRead from pcap file
-nDon't resolve hostnames
-v/-vv/-vvvVerbosity levels
-cCapture N packets then stop
-sSnap length (0 = full packet)
Examples
tcpdump -i eth0 -w /tmp/capture.pcapCapture all traffic to file · explain & risk-check →
tcpdump -i eth0 host 10.0.0.1 and port 443Capture HTTPS traffic to/from specific host · explain & risk-check →
tcpdump -i any port 53 -nMonitor all DNS queries · explain & risk-check →
tcpdump -r capture.pcap -n | grep HTTPAnalyze saved pcap for HTTP · explain & risk-check →
tcpdump -i eth0 'tcp[tcpflags] & tcp-syn != 0'Capture only SYN packets (detect port scans) · explain & risk-check →
Pro tip

Use `tcpdump -i any -w - | ssh user@analyst-host 'wireshark -k -i -'` to stream live capture directly to a remote Wireshark — analyze production traffic without storing pcap files locally.

Related
ss advanced nc nmap
Open the full explainer →More in Networking

Reference text is hand-written and may be incomplete — check man tcpdump for your version. Test destructive commands on a non-production system first.