tcpdump
networkingLinux/Unix
The tcpdump command is one of the most frequently used commands in Linux/Unix-like operating systems. tcpdump Dump network traffic, analyze and capture packets
Quick Reference
Command Name:
tcpdump
Category:
networking
Platform:
Linux/Unix
Basic Usage:
tcpdump [options] [arguments]
Common Use Cases
Syntax
tcpdump [options] [expression]
Options
Option | Description |
---|---|
-A |
Print each packet in ASCII, excluding the link level header |
-c count |
Exit after capturing count packets |
-D |
List available interfaces |
-e |
Print the link-level header |
-F file |
Use file as input for the filter expression |
-G rotate_seconds |
Rotate the dump file every rotate_seconds seconds |
-i interface |
Listen on specified interface |
-K |
Don't verify TCP checksums |
-n |
Don't convert addresses to names |
-p |
Don't put the interface into promiscuous mode |
-q |
Quick (quiet) output |
-r file |
Read packets from file (capture file) |
-s snaplen |
Capture snaplen bytes of data from each packet |
-S |
Print absolute TCP sequence numbers |
-t |
Don't print timestamp on each dump line |
-tt |
Print unformatted timestamp on each dump line |
-ttt |
Print delta between current and previous line |
-tttt |
Print timestamp in default format with date |
-v |
Verbose output (more -v's increases verbosity) |
-w file |
Write the raw packets to file |
-X |
Print each packet in hex and ASCII |
-XX |
Print each packet in hex and ASCII, including the link level header |
-Z user |
Drop privileges to user after opening capture device |
Examples
How to Use These Examples
The examples below show common ways to use the tcpdump
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
# Basic Examples Basic
# Capture packets on interface eth0
tcpdump -i eth0