Wireshark Cheatsheet
Capture Basics
Use this Wireshark reference while you build software engineering projects, review code, or refresh the syntax you reach for most.
Start a Capture
Wireshark 4.x opens on the welcome screen, a list of interfaces with live sparklines. Double-click an interface to start, or pick one and press the shark fin. The toolbar shortcuts matter more than the menus.
| Action | Shortcut | Notes |
|---|---|---|
| Start / stop capture | Ctrl+E | The same key toggles |
| Restart capture | Ctrl+R | Reloads the file when not capturing |
| Capture options | Ctrl+K | Interfaces, capture filter, output files |
| Refresh interfaces | F5 | After plugging in a NIC |
| Find packet | Ctrl+F | Then Ctrl+N next, Ctrl+B previous |
| Go to packet | Ctrl+G | By frame number |
| Mark / unmark selected | Ctrl+M | Marked packets can be exported on their own |
| Ignore / unignore selected | Ctrl+D | Hides a packet from dissection and stats |
| Set / unset time reference | Ctrl+T | Zeroes the relative clock at that frame |
| Time shift | Ctrl+Shift+T | Realign clocks across merged captures |
| Packet comment | Ctrl+Alt+C | Stored in the pcapng file |
| Preferences | Ctrl+Shift+P | Cmd+, on macOS |
| Configuration profiles | Ctrl+Shift+A | — |
| Resize all columns | Ctrl+Shift+R | Slow on very large files |
| Zoom | Ctrl+= / Ctrl+- / Ctrl+0 | Font size, 0 resets |
Auto-scroll and colorizing are toggles with no default key, in the Go and View
menus. View → Internals → Keyboard Shortcuts lists everything the build has.
On macOS the app is Wireshark.app and the CLI tools live in
/Applications/Wireshark.app/Contents/MacOS/. Homebrew installs tshark,
dumpcap, editcap, mergecap, and capinfos on PATH.
Interfaces and Permissions
Raw capture needs elevated privileges. The right fix is never running the GUI as
root, it is giving the small dumpcap helper the capability.
# List what you can capture on tshark -D dumpcap -D -M # machine-readable # Linux: let your user capture without sudo (Debian/Ubuntu) sudo dpkg-reconfigure wireshark-common # answer "Yes" sudo usermod -aG wireshark "$USER" # then log out and back in # Linux, manual equivalent sudo setcap cap_net_raw,cap_net_admin=eip "$(which dumpcap)" # macOS: the installer sets ChmodBPF, fix it with open "/Applications/Wireshark.app/Contents/Resources/Extras/"
Pseudo-interfaces worth knowing:
| Name | Captures |
|---|---|
any (Linux) | All interfaces at once, no promiscuous mode |
lo / lo0 | Loopback, the only way to see localhost traffic |
pktap, pktap,en0 (macOS) | Adds per-packet process metadata |
Cisco remote capture | RPCAP or an SSH remote capture extcap |
randpkt, ciscodump, sshdump | Extcap plugins, listed alongside real NICs |
Loopback traffic never crosses a NIC, so capturing on
en0oreth0shows nothing forcurl localhost. Use the loopback interface.
Capture Options (Ctrl+K)
The options dialog is where long captures are configured. Everything here has a
dumpcap flag equivalent, which is what to reach for on a server.
| GUI setting | CLI | Effect |
|---|---|---|
| Promiscuous mode | on by default, -p disables | Accept frames not addressed to you |
| Snaplen | -s <bytes> | Truncate each packet, e.g. -s 96 for headers only |
| Buffer size | -B <MiB> | Raise it to 32+ on busy links to stop drops |
| Monitor mode | -I | 802.11 radiotap headers, needed for real Wi-Fi work |
| Capture filter | -f "<bpf>" | BPF, applied in the kernel, cannot be undone later |
| Output file | -w file.pcapng | pcapng is the default format |
| Ring buffer | -b filesize:100000 -b files:20 | Bounded disk use |
| Stop after | -a duration:3600 | Also filesize:, files:, packets: |
# Headless long capture, 20 x 100 MB ring, rotate hourly too sudo dumpcap -i eth0 -s 0 -B 64 -w /var/log/cap.pcapng \ -b filesize:100000 -b files:20 -b duration:3600
Promiscuous Mode and Switches
Promiscuous mode makes your NIC accept frames it is not addressed to, but a switch still only forwards you your own traffic plus broadcast and multicast. Seeing someone else's packets needs help at the network layer.
- SPAN / port mirror, the switch copies a port or VLAN to your port. This is the normal answer in a managed network. - TAP, an inline hardware splitter. No configuration and no drops under load. - Hub, a genuine repeater floods every port. Real hubs are mostly gone. - On the host itself, capture on the machine that sends or receives. Always available and usually enough. - Wi-Fi monitor mode, the only way to see other stations, and it usually disconnects your own association while active.
Checking for drops matters as much as the filter. The status bar shows dropped
counts, and capinfos reports them after the fact.
capinfos -c -d -a -e -y capture.pcapng # counts, bytes, first/last, dropsSave, Split, and Merge
The GUI writes to a temp file until you save. File → Export Specified Packets
writes only what the display filter shows, which is how a 4 GB capture becomes a
4 MB attachment.
# Slice a time window out of a big file editcap -A "2026-09-15 10:00:00" -B "2026-09-15 10:05:00" big.pcapng cut.pcapng # Split into 100k-packet chunks, or 60-second chunks editcap -c 100000 big.pcapng part.pcapng editcap -i 60 big.pcapng minute.pcapng # Keep only packets matching a display filter tshark -r big.pcapng -Y "tcp.port == 443" -w tls-only.pcapng # Merge chronologically, then fix out-of-order timestamps mergecap -w all.pcapng a.pcapng b.pcapng reordercap all.pcapng sorted.pcapng # Strip payload before sharing, keep headers only editcap -s 96 big.pcapng headers.pcapng
| Format | Extension | Keeps |
|---|---|---|
| pcapng | .pcapng | Multiple interfaces, comments, nanosecond time, decryption secrets |
| pcap | .pcap | One link type, microsecond time. Use -F pcap for old tools |
| gzip | .pcapng.gz | Wireshark reads and writes it transparently |
A capture filter is destructive. Packets excluded by
-fwere never written and no display filter brings them back. When in doubt capture wide with a small snaplen and filter on display.