← Knowledge Base
NetworkingReference note1 min read · updated 2026-11-27

Capture packets with tcpdump

Filter by host, port and protocol, write a capture file and open it in Wireshark.

tcpdumppacketstroubleshooting
sudo tcpdump -i eth0 -n                          # everything, no name resolution
sudo tcpdump -i eth0 -n host 192.168.1.20 and port 443
sudo tcpdump -i any -n udp port 53               # DNS traffic
sudo tcpdump -i eth0 -n 'tcp[tcpflags] & tcp-syn != 0'   # SYN packets
sudo tcpdump -i eth0 -w capture.pcap -c 1000     # save 1000 packets
tcpdump -r capture.pcap -nn | less

Open capture.pcap in Wireshark for a friendly view. Capture on the interface that really carries the traffic, and use a filter to keep files small. HTTPS payloads are encrypted, but you still see who talks to whom, when and how much. Captures may contain passwords or personal data: handle and delete them carefully, and only capture on networks you are allowed to monitor.