Quick Linux Tip #10:
Try: sudo tcpdump -i eth0 -w capture.pcap 'host 192.168.1.100 and port 80 and tcp[13] & 2 != 0'
Info: tcpdump captures network packets with BPF filters. This example captures only SYN packets (TCP handshake start) to a specific host on port 80. Perfect for debugging network issues.
Examples:
- $ sudo tcpdump -i any -n 'port 443 and host github.com'
- $ sudo tcpdump -i eth0 -A 'tcp port 80' # Show ASCII payload
- $ sudo tcpdump -r capture.pcap 'tcp[tcpflags] & (tcp-syn|tcp-ack) == tcp-syn'
Note: Use -w to save and -r to read pcap files. BPF filters: tcp[13] & 2 checks the SYN flag. Open .pcap files in Wireshark for GUI analysis.
Leave a Reply