Forrest logo
tool overview
On this page you find all important commands for the CLI tool tshark. If the command you are looking for is missing please ask our AI.

tshark

Tshark is a powerful command-line tool used for network protocol analysis and packet capturing. It is part of the Wireshark network analysis suite and provides a lightweight alternative for analyzing network traffic.

Here are some key features of tshark:

  1. Protocol support: Tshark supports a wide range of network protocols, including TCP, UDP, IP, HTTP, DNS, SSL, and many more. It can dissect and display packet details at different protocol layers.

  2. Packet capturing: Tshark can capture live network traffic directly from network interfaces or read packet capture files (e.g., pcap or pcapng files) created by other tools.

  3. Filtering and selection: It allows users to apply filters based on various criteria like source/destination IP address, port numbers, protocols, packet length, and more. This helps in narrowing down the analysis to specific packets of interest.

  4. Display customization: Tshark provides options to customize the output format and display fields according to user preferences. It can output packet details in different formats like CSV, JSON, or even export to other tools for further analysis.

  5. Statistics and analysis: It can generate statistics and summaries, such as conversation statistics, protocol hierarchy, I/O graphs, or endpoints statistics. These features help in gaining insights into the network traffic patterns and behavior.

  6. Command-line automation: Tshark's command-line interface makes it suitable for automation and scripting purposes. It can be easily integrated into scripts or workflows to automate packet capture, analysis, and reporting tasks.

  7. Cross-platform support: Tshark is available on multiple platforms, including Windows, macOS, and Linux, making it accessible to a wide range of users.

Overall, tshark is a versatile tool that allows network administrators, security analysts, and network engineers to analyze and troubleshoot network issues efficiently through the command line interface.

List of commands for tshark:

  • tshark:tldr:029f4 tshark: Only capture packets matching a specific capture filter.
    $ tshark -f '${udp port 53}'
    try on your machine
    explain this command
  • tshark:tldr:04469 tshark: Analyze packets from a file.
    $ tshark -r ${filename-pcap}
    try on your machine
    explain this command
  • tshark:tldr:51c4b tshark: Monitor everything on localhost.
    $ tshark
    try on your machine
    explain this command
  • tshark:tldr:606c3 tshark: Only show packets matching a specific output filter.
    $ tshark -Y '${http-request-method == "GET"}'
    try on your machine
    explain this command
  • tshark:tldr:a1a50 tshark: Select specific fields to output.
    $ tshark -T ${select} -e ${http-request-method} -e ${ip-src}
    try on your machine
    explain this command
  • tshark:tldr:b0a83 tshark: Decode a TCP port using a specific protocol (e.g. HTTP).
    $ tshark -d tcp.port==${8888},${http}
    try on your machine
    explain this command
  • tshark:tldr:ef8ef tshark: Write captured packet to a file.
    $ tshark -w ${filename}
    try on your machine
    explain this command
  • tshark:tldr:f0e77 tshark: Specify the format of captured output.
    $ tshark -T ${select}
    try on your machine
    explain this command
tool overview