A single network problem can account for a small fraction of the traffic in a packet capture. On the Linux desktop, Wireshark can export the packets you need to a separate pcapng file while keeping the original capture intact.

A display filter narrows the packet list without changing the capture file. Export Specified Packets can save the matching packets so the recipient can open the subset on its own.

An exported file can still contain private addresses, payloads, and capture metadata. Check what the recipient is allowed to see before sharing it.

Steps to export packets from Wireshark:

Start with your saved pcapng file open in Wireshark's Default profile and the display filter bar empty. The example uses ~/Documents/captures/web-traffic.pcapng, which contains DNS and web traffic.

  1. Click the display filter bar above the packet list.

    A filter on the contents of individual packets, such as dns for DNS over UDP, can be checked in both files. Wireshark renumbers frames in the new file, so a frame-number filter can match different packets.

  2. Type the display filter for the packets you want to keep.
  3. Press Enter to apply the filter.
  4. Note the Displayed count in the status bar.

    In the example, 158 of 666 packets match. With zero matches, Wireshark would select Captured and export every packet. If Displayed is zero, stop and correct the filter before exporting.

  5. Choose File > Export Specified Packets.
  6. Select Displayed under Packet Range.
  7. Select All packets under Packet Range.
  8. Confirm that the Displayed column of the All packets row shows the count you noted.

    If the counts differ, stop before saving. The Include depended upon packets option can add frames used for reassembly.

  9. Click the File name field.
  10. Enter the full path to a new file in the original capture's folder.

    The example saves ~/Documents/captures/dns-traffic.pcapng. The Export as field shows the capture format.

  11. Click Save.

    Wireshark returns to the original capture after saving the new file.

  12. Choose File > Open in the same Wireshark window.
  13. Select the exported capture in Open Capture File.

    An empty Read filter lets Wireshark load every packet in the file for the count check.

  14. Click Open.
  15. Compare the reopened file's Packets count with the original Displayed count you noted.

    Both counts should be the same. The example reopens dns-traffic.pcapng with 158 packets.

  16. Confirm that Displayed equals Packets under the same display filter in the reopened file.

    Wireshark keeps the filter applied in the same window. Displayed: 158 (100.0%) in the example means every packet in the export matches dns.

Share this guide