Networking/Computing Tips/Tricks

Rate this content:
5 of 5 - 1 votes
Thank you for rating this article.

One of the utilities that is included in your Wireshark distribution is a command line tool called 'mergecap'.  We use this tool to merge multiple captures generated, let's say, from a ring buffer capture (you can see how to do ring buffer captures using T-Shark here).

Alright, so let's say you have a ring buffer capture, as I do:


There are two options for merging these files:

  1. Open the oldest one in the Wireshark GUI, and then methodically use the File> Merge option for the rest of the files (in order).  Wireshark will merge them.
  2. Use the 'mergecap' command line tool.

This article shows how to use the mergecap tool using Windows, but you should be able to follow the exact step by step on Linux and MAC.

Begin by opening the Command Line (or terminal) window, and change directory to the C:/Program Files/Wireshark> directory as shown:


From this location you can view the mergecap help by typing "mergecap -h":


There are several options for concatenation, truncation, etc.  We will keep it simple and merge the files that were part of the ring buffer shown above.

To make my command easier, I renamed the filenames to ring2 - ring11:



Our command is: 'mergecap -w c:\mycaptures\mergedfile.pcap c:\mycaptures\ring2.pcap c:\mycaptures\ring3.pcap c:\mycaptures\ring4.pcap c:\mycaptures\ring5.pcap c:\mycaptures\ring6.pcap c:\mycaptures\ring7.pcap c:\mycaptures\ring8.pcap c:\mycaptures\ring9.pcap c:\mycaptures\ring10.pcap c:\mycaptures\ring11.pcap'


My system completed the task almost instantaneously.  If you are working with larger files, this will not be the case, but it will still be lightning fast.  You can add the '-v' verbose switch if you want to see things are hapenning.

OK - let's see the results!  First we see the newly created file:


Now this file can be openned in the Wireshark GUI.

You can see more information here:

Happy packet sniffing.

I hope you find this article and its content helpful.  Comments are welcomed below.  If you would like to see more articles like this, please support us by clicking the patron link where you will receive free bonus access to courses and more, or simply buying us a cup of coffee!, and all comments are welcome!

Did you learn something?
Did I save you time? 

Buy me a coffeeBuy me a coffee!

Find by Tag

5G Networks 6LoWLAN 6LoWPAN 802.11 802.11ah 802.11ax 802.11ay 802.11az ACL Addressing Analysis Ansible Architecture ARP Assessment AToM Backup Bandwidth BGP Biography Bloom's Taxonomy Briefings CBRS CellStream Cellular Central Office Cheat Sheet Chrome Cisco Clock Cloud Computer Consulting CPI Data Center Data Networking Decryption DHCPv4 DHCPv6 Display Filter DNS Documentation ECMP EIGRP Ethernet Ethics Flipping the Certification Model Follow Me Fragmentation Git GNS3 Google GQUIC Hands-On History Home Network HTTPS ICMP ICMPv6 IEEE 802.11p IEEE 802.15.4 In A Day Internet IOS Classic IoT IPv4 IPv6 IS-IS L2 Switch L2VPN L3VPN LDP Learning Services Linux LLN Logging LoL M-BGP MAC MAC OSx Macro Microsoft mininet Monitoring Monitor Mode MPLS Multicast Name Resolution Netflow NetMon netsh Networking Network Science nmap Npcap nslookup Online Learning Online School OpenFlow OSPF OSPFv2 OSPFv3 OSX Parrot PIM Ping Policy POTS POTS to Pipes PPP Profile Profiles Programming Project Management PW3E Python QoS QUIC Requirements RIP Routing RPL RSVP Rural SAS SDN Security Self Certification Service Provider Services Sharepoint Small Business Smartport SONET Speed SSH SSL Subnetting T-Shark TCP TCP/IP Telco Telecom 101 Telecommunications Telephone Telnet Terminal TLS Tools Traceroute Traffic Analysis Traffic Engineering Training Travel Tunnel Utility Video Virtualbox Virtualization Voice VoIP VRF VXLAN Webex Wi-Fi Wi-Fi 6 Wi-Fi 6/6E Windows Wireless Wireless 5G Wireshark Wireshark Tip WLAN ZigBee Zoom

Twitter Feed