UnixDroid

Lesson 02 of 5

Wireshark Filters: Capture Filters vs Display Filters (Cheat Sheet)

3 min read

Cut thousands of packets down to what matters with capture filters, display filters and the right operators.

A busy network produces thousands of packets every minute. Filters are how you find the few that matter. Wireshark has two different kinds of filters with different syntax, and mixing them up is the most common beginner mistake.

Capture filters vs display filters

  • Capture filter – set before you start. Wireshark only saves packets that match. It uses BPF syntax (the same as tcpdump). Anything it drops is gone for good.
  • Display filter – set after capturing. It hides non-matching packets but keeps everything in the file, so you can change it any time.

Rule of thumb: on your own machine, capture everything and use display filters. Use capture filters only on very busy links where the file would get too big.

Capture filter examples (BPF)

Type these in the box on the start screen, before you double-click an interface:

host 192.168.1.5               # traffic to or from one IP
net 192.168.1.0/24             # one subnet
port 53                        # DNS only
tcp port 443                   # HTTPS only
host 192.168.1.5 and port 80   # combine with and / or / not
not arp and not port 53        # drop the noise

Display filter examples

Type these in the green bar above the packet list and press Enter:

Wireshark display filters cheat sheet: ip.addr, tcp.port, dns, http.request.method, tcp.flags.syn and more
Wireshark display filters cheat sheet: ip.addr, tcp.port, dns, http.request.method, tcp.flags.syn and more
ip.addr == 192.168.1.5
ip.src == 192.168.1.5 && tcp.port == 443
dns
http.request
http.response.code >= 400
tcp.flags.syn == 1 && tcp.flags.ack == 0
frame contains "login"
!(arp || dns || icmp)

The bar turns green when the filter is valid and red when it isn't, so you know straight away if you made a typo.

Display filter operators

  • == equal, != not equal
  • >, <, >=, <= for numbers
  • && (and), || (or), ! (not)
  • contains – the field contains some text
  • matches – the field matches a regular expression

You can also write the word versions: eq, ne, and, or, not.

Build filters without memorising anything

You don't have to know field names by heart:

  • Click any field in the packet details pane. Its filter name appears in the status bar at the bottom.
  • Right-click a field → Apply as Filter → Selected to filter on it instantly.
  • Right-click → Prepare as Filter to build up a longer filter piece by piece.
  • Save filters you use often as buttons with the + on the right of the filter bar.

Common mistakes

  • Typing a BPF capture filter like port 80 into the display filter bar. Display filters use tcp.port == 80.
  • Writing ip.addr != 192.168.1.5 to hide one host. Because a packet has two addresses, this doesn't do what you expect. Use !(ip.addr == 192.168.1.5) instead.
  • Forgetting to clear an old filter and thinking packets are "missing".

Simple words mein (Hinglish)

Capture filter capture shuru karne se pehle lagta hai aur jo match nahi hota woh save hi nahi hota. Display filter baad mein lagta hai aur sirf chhupata hai, delete nahi karta. Beginners ke liye best: sab capture karo, phir display filter lagao jaise ip.addr == 192.168.1.5, dns, ya http.request. Filter bar green ho to sahi, red ho to galti hai.

FAQ

What is the difference between a capture filter and a display filter? A capture filter decides what gets saved (BPF syntax, set before capturing). A display filter decides what you see (Wireshark syntax, set after capturing).

How do I filter by IP address in Wireshark? Use ip.addr == 192.168.1.5 for both directions, or ip.src / ip.dst for one direction.

How do I filter by port in Wireshark? Use tcp.port == 443 or udp.port == 53.

How do I show only HTTP requests? Use http.request.

Practice task

  • Open your first-capture.pcapng from Lesson 1
  • Show only DNS, then only traffic to one website's IP
  • Find one field by clicking it, then use Apply as Filter on it
  • Save your three favourite filters as buttons

Next lesson: reading real conversations – the TCP handshake, DNS lookups and HTTP requests.