Capture vs Display Filters
Two filters, different jobs
A capture filter decides which packets enter the recording pipeline; packets excluded at that stage cannot be recovered from that file. Wireshark display filters select already recorded packets for inspection. Clearing a display filter reveals other recorded packets. For this course only use offline display filtering; capture expressions are examples for recognizing syntax, not instructions to capture a live interface.
Read the filter language
The libpcap expression udp port 53 selects UDP packets with source or destination port 53, not necessarily valid DNS. The display expression dns selects packets decoded as DNS. A port number is only a convention. dns.qry.name is a decoded field; == compares its value. For a boolean TCP flag, compare explicitly with 1 to test whether it is set. The following strings use documented fields available in Wireshark 4.6.x; no local analyzer test was performed.
Capture filter (libpcap): udp port 53Display filter (Wireshark): dnsDisplay filter: dns.qry.name == "app.example.com"Display filter: tcp.flags.syn == 1Display filter: tls.handshake.type == 1Offline TShark commands
If TShark is installed, check its version, then run the following in the directory containing the supplied PCAP. -r reads the named file, -Y applies a display filter, -T fields selects field-oriented output and each -e names a field. Single quotes are for a POSIX-style shell; adapt quoting for other shells. Do not remove -r: without an input file, TShark may attempt live capture. These are documentation-checked commands, not observed output.
tshark -vtshark -r chapter-30-synthetic.pcap -Y 'dns' -T fields -e frame.number -e dns.qry.nametshark -r chapter-30-synthetic.pcap -Y 'tcp.flags.syn == 1' -T fields -e frame.numbertshark -r chapter-30-synthetic.pcap -Y 'tls.handshake.type == 1' -T fields -e frame.numberPredict the matches
In our ten-frame trace, DNS queries and replies are frames 3 and 4, both with the same question. TCP SYN is set in frames 7 and 8, including the SYN-ACK. The ClientHello is frame 10. These are expected selections derived from fixture bytes, not output of a Wireshark run. Field availability, preferences, decoding and reassembly can affect actual matches.
Practice and privacy
Which language would show only TCP SYN packets in an existing file? Use the display expression above. Do not assume the hidden packets were deleted or that exporting a filtered subset removes all sensitive payloads or metadata. Share only synthetic or specifically authorized and reviewed captures. Next, correlate packets into a timeline.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Capture vs Display Filters Quiz
Apply offline capture-analysis concepts to synthetic evidence.
Which filter is appropriate for inspecting an already saved file?
What does udp port 53 select in libpcap syntax?
Which fixture frames match tcp.flags.syn == 1?
What is the function of TShark -r?
After clearing a display filter, what happens to previously hidden packets?