tshark -vDisplays the version information and compiled-in options for Tshark.
The utilities that ship with Wireshark — editcap, mergecap, capinfos, dumpcap and text2pcap — for working with capture files.
sudo apt install wireshark-commoncapinfos capture.pcapPrints general metadata statistics about a capture file including duration and packet counts.
Example
capinfos traffic.pcapcapinfos -c capture.pcapDisplays only the total count of packets contained in the capture file.
Example
capinfos -c traffic.pcapcapinfos -u capture.pcapDisplays the start and end timestamps of the capture duration.
Example
capinfos -u traffic.pcapcapinfos -s capture.pcapDisplays the size of the capture file in bytes.
Example
capinfos -s traffic.pcapcapinfos -d capture.pcapDisplays the total data size of all packets excluding file overhead.
Example
capinfos -d traffic.pcapdumpcap -i eth0 -w output.pcapCaptures packets from a specific interface and writes them directly to a file.
Example
dumpcap -i eth0 -w raw_capture.pcapdumpcap -i any -w output.pcapCaptures traffic from all available interfaces simultaneously on Linux systems.
Example
dumpcap -i any -w all_interfaces.pcapdumpcap -i eth0 -c 100 -w output.pcapStops the packet capture automatically after capturing exactly 100 packets.
Example
dumpcap -i eth0 -c 100 -w sample.pcapdumpcap -i eth0 -a duration:60 -w output.pcapStops the packet capture automatically after 60 seconds.
Example
dumpcap -i eth0 -a duration:60 -w minute_capture.pcapdumpcap -i eth0 -a filesize:10000 -w output.pcapStops the capture when the output file size reaches 10,000 kilobytes.
Example
dumpcap -i eth0 -a filesize:10000 -w limited_size.pcapdumpcap -i eth0 -b files:5 -b filesize:50000 -w buffer.pcapUses a ring buffer to keep the last 5 files of 50MB each, overwriting old ones.
Example
dumpcap -i eth0 -b files:5 -b filesize:50000 -w evidence.pcapdumpcap -i eth0 -b duration:3600 -w hourly.pcapCreates a new capture file every hour continuously.
Example
dumpcap -i eth0 -b duration:3600 -w hourly_log.pcapdumpcap -i eth0 -f "tcp port 80" -w web.pcapCaptures only TCP traffic destined for or originating from port 80.
Example
dumpcap -i eth0 -f "tcp port 80" -w web_traffic.pcapdumpcap -i eth0 -f "host 192.168.1.5" -w host.pcapCaptures only traffic involving the specific IP address 192.168.1.5.
Example
dumpcap -i eth0 -f "host 192.168.1.5" -w target.pcapdumpcap -i eth0 -f "not port 22" -w no_ssh.pcapCaptures all traffic except SSH traffic on port 22.
Example
dumpcap -i eth0 -f "not port 22" -w clean.pcapdumpcap -i eth0 -p -w output.pcapCaptures in non-promiscuous mode, seeing only traffic addressed to the interface.
Example
dumpcap -i eth0 -p -w unicast_only.pcaptshark -r capture.pcap -t adDisplays packet timestamps as absolute dates with time.
Example
tshark -r traffic.pcap -t adtshark -r capture.pcap -t udDisplays packet timestamps using UTC absolute date and time.
Example
tshark -r traffic.pcap -t udtshark -r capture.pcap -t dDisplays timestamps as the time delta from the previous displayed packet.
Example
tshark -r traffic.pcap -t dtshark -r capture.pcap -Y "http"Displays only packets that are identified as HTTP protocol.
Example
tshark -r traffic.pcap -Y "http"tshark -r capture.pcap -Y "ip.addr == 192.168.1.1"Displays only packets where the source or destination IP matches the address.
Example
tshark -r traffic.pcap -Y "ip.addr == 192.168.1.1"tshark -r capture.pcap -Y "tcp.flags.reset == 1"Displays only TCP packets where the RST (reset) flag is set.
Example
tshark -r traffic.pcap -Y "tcp.flags.reset == 1"tshark -r capture.pcap -Y "frame.len > 1000"Displays only packets with a frame length greater than 1000 bytes.
Example
tshark -r traffic.pcap -Y "frame.len > 1000"tshark -r capture.pcap -2 -R "tcp.analysis.retransmission"Performs a two-pass analysis to accurately detect and filter TCP retransmissions.
Example
tshark -r traffic.pcap -2 -R "tcp.analysis.retransmission"tshark -r capture.pcap -T fields -e ip.src -e ip.dstExtracts and prints only the source and destination IP addresses.
Example
tshark -r traffic.pcap -T fields -e ip.src -e ip.dsttshark -r capture.pcap -T fields -e http.host -e http.request.uriExtracts the HTTP host and requested URI from HTTP traffic.
Example
tshark -r traffic.pcap -T fields -e http.host -e http.request.uritshark -r capture.pcap -T fields -e dns.qry.nameExtracts only the DNS query names being requested in the traffic.
Example
tshark -r traffic.pcap -T fields -e dns.qry.nametshark -r capture.pcap -T fields -e frame.number -e ip.src -E separator=,Outputs the extracted fields in CSV format separated by commas.
Example
tshark -r traffic.pcap -T fields -e frame.number -e ip.src -E separator=,tshark -r capture.pcap -T fields -e ip.src -E header=yIncludes a header row describing the fields in the text output.
Example
tshark -r traffic.pcap -T fields -e ip.src -E header=ytshark -r capture.pcap -T jsonExports the full dissection of packets into a detailed JSON format.
Example
tshark -r traffic.pcap -T jsontshark -r capture.pcap -T jsonrawExports the packet dissection to JSON including the raw hex data for fields.
Example
tshark -r traffic.pcap -T jsonrawtshark -r capture.pcap -T ekExports packets in Newline Delimited JSON format suitable for Elasticsearch.
Example
tshark -r traffic.pcap -T ektshark -r capture.pcap -xPrints the packet data in both hex and ASCII format alongside the summary.
Example
tshark -r traffic.pcap -xtshark -r capture.pcap -q -z io,phsDisplays the Protocol Hierarchy Statistics showing traffic distribution by protocol.
Example
tshark -r traffic.pcap -q -z io,phstshark -r capture.pcap -q -z conv,ipDisplays a table of IPv4 conversations including packet counts and bytes.
Example
tshark -r traffic.pcap -q -z conv,iptshark -r capture.pcap -q -z conv,tcpDisplays a table of TCP conversations identifying active connections.
Example
tshark -r traffic.pcap -q -z conv,tcptshark -r capture.pcap -q -z endpoints,ipLists all IPv4 endpoints found in the capture file with traffic stats.
Example
tshark -r traffic.pcap -q -z endpoints,iptshark -r capture.pcap -q -z expertDisplays expert info warnings, errors, and notes detected in the trace.
Example
tshark -r traffic.pcap -q -z experttshark -r capture.pcap -q -z http,treeCalculates and displays a statistical tree of HTTP packet distribution.
Example
tshark -r traffic.pcap -q -z http,treetshark -r capture.pcap -q -z http,statDisplays HTTP status code statistics and request distribution.
Example
tshark -r traffic.pcap -q -z http,stattshark -r capture.pcap -q -z dns,treeDisplays a statistical tree summarizing DNS query types and response codes.
Example
tshark -r traffic.pcap -q -z dns,treetshark -r capture.pcap -q -z io,stat,1Calculates traffic statistics in 1-second intervals.
Example
tshark -r traffic.pcap -q -z io,stat,1tshark -r capture.pcap -q -z io,stat,1,"COUNT(tcp.analysis.retransmission) tcp.analysis.retransmission"Counts TCP retransmissions per second to identify network congestion.
Example
tshark -r traffic.pcap -q -z io,stat,1,"COUNT(tcp.analysis.retransmission) tcp.analysis.retransmission"tshark -r capture.pcap -o "ssl.keys_list:0.0.0.0,443,http,server.pem"Decrypts SSL/TLS traffic using the provided server private key file.
Example
tshark -r traffic.pcap -o "ssl.keys_list:0.0.0.0,443,http,server.pem"tshark -r capture.pcap -o "tls.keylog_file:secrets.log"Decrypts TLS traffic using a browser-generated session key log file.
Example
tshark -r traffic.pcap -o "tls.keylog_file:secrets.log"tshark -r capture.pcap -o "tcp.desegment_tcp_streams:TRUE"Forces reassembly of TCP segments to analyze complete application layer payloads.
Example
tshark -r traffic.pcap -o "tcp.desegment_tcp_streams:TRUE"tshark -r capture.pcap -d tcp.port==8080,httpDecodes traffic on TCP port 8080 as HTTP regardless of standard port assignments.
Example
tshark -r traffic.pcap -d tcp.port==8080,httptshark -r capture.pcap -z follow,tcp,ascii,0Follows TCP stream index 0 and displays the content in ASCII format.
Example
tshark -r traffic.pcap -z follow,tcp,ascii,0tshark -r capture.pcap -z follow,udp,hex,0Follows UDP stream index 0 and displays the content in Hex format.
Example
tshark -r traffic.pcap -z follow,udp,hex,0tshark -r capture.pcap --export-objects http,./output_dirExtracts all files (images, binaries) transferred via HTTP to the specified directory.
Example
tshark -r traffic.pcap --export-objects http,./filestshark -r capture.pcap --export-objects smb,./output_dirExtracts files transferred over SMB/CIFS shares to the specified directory.
Example
tshark -r traffic.pcap --export-objects smb,./filestshark -r capture.pcap -T fields -e ip.src -e ip.geoip.countryDisplays source IP addresses alongside their resolved GeoIP country.
Example
tshark -r traffic.pcap -T fields -e ip.src -e ip.geoip.countrytshark -r full.pcap -Y "tcp.port == 80" -w http_only.pcapReads a capture file, applies a display filter, and saves the matches to a new file.
editcap -I 128 input.pcap output.pcapInjects packet length errors or trims packets to remove sensitive payload data (requires editcap).
Example
editcap -I 128 sensitive.pcap sanitized.pcaptshark -r capture.pcap -s 64 -w header_only.pcapReads a file and saves only the first 64 bytes of each packet, discarding payloads.
Example
tshark -r traffic.pcap -s 64 -w headers.pcaptshark -r capture.pcap -Y "gtp"Filters traffic to show GPRS Tunneling Protocol packets used in mobile networks.
Example
tshark -r traffic.pcap -Y "gtp"tshark -r capture.pcap -Y "vxlan"Filters traffic to show VXLAN encapsulated packets common in data centers.
Example
tshark -r traffic.pcap -Y "vxlan"tshark -r capture.pcap -Y "vlan.id == 10"Filters traffic belonging specifically to VLAN ID 10.
Example
tshark -r traffic.pcap -Y "vlan.id == 10"tshark -r wifi.pcap -Y "wlan.fc.type_subtype == 0x08"Filters specific 802.11 frame types, such as Beacon frames (subtype 0x08).
tshark -i usbmon0Captures USB traffic on Linux systems using the usbmon interface.
tshark -i bluetooth0Captures Bluetooth traffic if the hardware and drivers support monitor mode.
tshark -r capture.pcap -Y "tcp.analysis.lost_segment"Identifies packets that indicate a previous TCP segment was lost in transit.
Example
tshark -r traffic.pcap -Y "tcp.analysis.lost_segment"tshark -r capture.pcap -Y "tcp.analysis.window_full"Identifies when the TCP receive window is full, indicating a potential bottleneck.
Example
tshark -r traffic.pcap -Y "tcp.analysis.window_full"tshark -r capture.pcap -Y "http.request.method == POST"Filters for HTTP POST requests which often contain form submissions or uploads.
Example
tshark -r traffic.pcap -Y "http.request.method == POST"tshark -r capture.pcap -Y "tcp.port == 4444"Filters for traffic on port 4444, a common default port for Metasploit payloads.
Example
tshark -r traffic.pcap -Y "tcp.port == 4444"tshark -r capture.pcap -Y "dns.qry.name contains \"base64\""Searches for DNS queries containing suspicious strings like 'base64' indicating tunneling.
Example
tshark -r traffic.pcap -Y "dns.qry.name contains \"base64\""tshark -r capture.pcap -Y "tls.handshake.extensions_server_name"Inspects the SNI (Server Name Indication) in TLS handshakes to see target domains.
Example
tshark -r traffic.pcap -Y "tls.handshake.extensions_server_name"tshark -r capture.pcap -T text -e frame.numberForces standard text output even if configured otherwise in preferences.
Example
tshark -r traffic.pcap -T texttshark -r capture.pcap -T tabsDisplays packet summaries with tab-separated columns for easier parsing.
Example
tshark -r traffic.pcap -T tabstshark -i eth0 -lFlushes the standard output after every packet, useful when piping to other tools.
tshark -i eth0 -a duration:10Captures and displays packets for 10 seconds before terminating.
tshark -r capture.pcap -R "ip.addr==1.2.3.4" -2Uses a read filter with two-pass analysis, necessary for some complex filters.
Example
tshark -r traffic.pcap -R "ip.addr==1.2.3.4" -2mergecap -w merged.pcap file1.pcap file2.pcapCombines multiple capture files into a single file based on packet timestamps.
Example
mergecap -w combined.pcap part1.pcap part2.pcapdiff <(tshark -r f1.pcap) <(tshark -r f2.pcap)Uses bash process substitution and tshark to textually compare two capture files.
editcap -d input.pcap output.pcapRemoves duplicate packets from a capture file based on a moving time window.
Example
editcap -d duplicate.pcap unique.pcapeditcap -t 3600 input.pcap output.pcapAdjusts the timestamp of every packet in the file forward by 3600 seconds.
Example
editcap -t 3600 input.pcap timezone_fix.pcapeditcap -F pcapng input.pcap output.pcapngConverts an old PCAP file format to the newer, more versatile PCAPNG format.
Example
editcap -F pcapng old.pcap new.pcapngtshark -r capture.pcap -z io,phs,udpDisplays protocol hierarchy statistics specifically filtering for the UDP branch.
Example
tshark -r traffic.pcap -z io,phs,udptshark -r capture.pcap -T fields -e frame.number -e tcp.analysis.ack_rttExtracts the Round Trip Time (RTT) for TCP acknowledgments to analyze latency.
Example
tshark -r traffic.pcap -T fields -e frame.number -e tcp.analysis.ack_rtttshark -r large.pcap -c 1000Reads only the first 1000 packets of a large file to avoid loading everything.
Example
tshark -r gigabyte.pcap -c 1000tshark -r capture.pcap -Y "http.authbasic"Filters for HTTP Basic Authentication headers which contain base64 credentials.
Example
tshark -r traffic.pcap -Y "http.authbasic"tshark -r capture.pcap -Y "ftp.request.command == USER || ftp.request.command == PASS"Filters for FTP login commands to capture cleartext usernames and passwords.
Example
tshark -r traffic.pcap -Y "ftp.request.command == USER || ftp.request.command == PASS"tshark -r capture.pcap -T ek -J "http tcp ip"Generates Elasticsearch-compatible JSON only for the HTTP, TCP, and IP layers.
Example
tshark -r traffic.pcap -T ek -J "http tcp ip"tshark -r capture.pcap -o "gui.column.format:\"Source\",\"%s\",\"Dest\",\"%d\""Overrides the default summary columns with custom columns defined in the command.
Example
tshark -r traffic.pcap -o "gui.column.format:\"Source\",\"%s\",\"Dest\",\"%d\""dumpcap -i eth0 -w output.pcap -f "tcp[13] & 8 != 0"Uses a raw BPF bitmask filter to capture only TCP packets with the PSH flag set.
Example
dumpcap -i eth0 -w push.pcap -f "tcp[13] & 8 != 0"Wireshark’s terminal version: capture and decode traffic with full dissectors and display filters, and extract fields to text.
The classic packet capture tool: capture and filter traffic with BPF expressions and write it to pcap files for later analysis.
Replays captured pcap traffic onto a network at chosen speeds — useful for testing IDS rules and network devices.