Linux Network command –tcpdump

Examples:

Show details of packets
#tcpdump -nnvvXS

tcpdump

show specific type of connection
#tcpdump icmp/tcp/udp

Add more options with source/destination IP/port, write to file
tcpdump -nnvvXS src 1.2.3.4 and port 3306 -w /tmp/test.pcap

Read tcpdump log from the file
tcpdump -qns -0 A -r /tmp/test.pcap

tcpick -C -yP -r /tmp/test.pcap

ngrep
ngrep -d any -W byline dst 1.2.3.4 > /tmp/test.pcap