Back to search

tcpdump

command network

Capture and analyze network traffic

Required Packages

sudo apt install -y tcpdump

Options

Network interface to capture on (default: first available, 'any' for all)

Stop after capturing N packets

Save raw packets to a pcap file

Read packets from a pcap file instead of live capture

Show IP addresses instead of hostnames (faster)

Show port numbers instead of service names

Print each packet in ASCII (useful for HTTP)

Print each packet in hex and ASCII

Bytes to capture per packet (0 = full packet, default: 262144)

BPF filter (e.g. 'port 80', 'host 10.0.0.1', 'tcp and port 443')

Generated Command

sudo tcpdump -n