Quicklinks: manpage | Wireshark Docs | code
tshark -b files:$NUM
, and need one fileeditcap -c/-i
mergecap
assumes that all packet captures are already correctly ordered.
If one of the source capture has out-of-order packets, the merged capture will have unpredictably located, out-of-order packets.
mergecap
will save a file as pcapng unless a different capture type is specified.
This means that mergecap file1.pcap ... -w merged.pcap
will have a pcap extension but filetype pcapng.
Combine all .pcap files in current directory
mergecap *.pcap -w merged.pcapng
Combine all files recursively in a directory ( inspiration)
find /path/to/dir -type f -maxdepth 2 \
| xargs mergecap -w merged.pcapng
Same as above, but reorder all pcaps before merging (preempts caveat)
find /path/to/dir -type f -maxdepth 2 \
| xargs -I"{}" reordercap "{}" "{}" \
| xargs mergecap -w merged.pcapng
joincap is a go-based tool that merges captures together, but avoids these errors:
tcpslice merges captures together with 1.5X throughput and speed compared to mergecap (based on mergecap v2.4.5 testing). It has fewer features: Namely, it can only merge and select packets based upon timestamp. It will also fail if the difference between timestamps exceeds a year.