{
    "mode": "man",
    "parameter": "tcpdump",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/tcpdump/8/json",
    "generated": "2026-06-15T16:02:06Z",
    "synopsis": "tcpdump [ -AbdDefhHIJKlLnNOpqStuUvxX# ] [ -B buffersize ]\n[ -c count ] [ --count ] [ -C filesize ]\n[ -E spi@ipaddr algo:secret,...  ]\n[ -F file ] [ -G rotateseconds ] [ -i interface ]\n[ --immediate-mode ] [ -j tstamptype ] [ -m module ]\n[ -M secret ] [ --number ] [ --print ] [ -Q in|out|inout ]\n[ -r file ] [ -s snaplen ] [ -T type ] [ --version ]\n[ -V file ] [ -w file ] [ -W filecount ] [ -y datalinktype ]\n[ -z postrotate-command ] [ -Z user ]\n[ --time-stamp-precision=tstampprecision ]\n[ --micro ] [ --nano ]\n[ expression ]",
    "sections": {
        "NAME": {
            "content": "tcpdump - dump traffic on a network\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "tcpdump [ -AbdDefhHIJKlLnNOpqStuUvxX# ] [ -B buffersize ]\n[ -c count ] [ --count ] [ -C filesize ]\n[ -E spi@ipaddr algo:secret,...  ]\n[ -F file ] [ -G rotateseconds ] [ -i interface ]\n[ --immediate-mode ] [ -j tstamptype ] [ -m module ]\n[ -M secret ] [ --number ] [ --print ] [ -Q in|out|inout ]\n[ -r file ] [ -s snaplen ] [ -T type ] [ --version ]\n[ -V file ] [ -w file ] [ -W filecount ] [ -y datalinktype ]\n[ -z postrotate-command ] [ -Z user ]\n[ --time-stamp-precision=tstampprecision ]\n[ --micro ] [ --nano ]\n[ expression ]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Tcpdump prints out a description of the contents of packets on a network interface that match\nthe Boolean expression; the description is preceded by a time stamp, printed, by default,  as\nhours,  minutes,  seconds, and fractions of a second since midnight.  It can also be run with\nthe -w flag, which causes it to save the packet data to a file  for  later  analysis,  and/or\nwith  the -r flag, which causes it to read from a saved packet file rather than to read pack‐\nets from a network interface.  It can also be run with the -V flag, which causes it to read a\nlist  of  saved  packet  files. In all cases, only packets that match expression will be pro‐\ncessed by tcpdump.\n\nTcpdump will, if not run with the -c flag, continue capturing packets until it is interrupted\nby  a  SIGINT  signal  (generated, for example, by typing your interrupt character, typically\ncontrol-C) or a SIGTERM signal (typically generated with the kill(1) command);  if  run  with\nthe -c flag, it will capture packets until it is interrupted by a SIGINT or SIGTERM signal or\nthe specified number of packets have been processed.\n\nWhen tcpdump finishes capturing packets, it will report counts of:\n\npackets ``captured'' (this is the number of packets that tcpdump has received and pro‐\ncessed);\n\npackets  ``received by filter'' (the meaning of this depends on the OS on which you're\nrunning tcpdump, and possibly on the way the OS was configured - if a filter was spec‐\nified  on  the command line, on some OSes it counts packets regardless of whether they\nwere matched by the filter expression and, even if they were matched by the filter ex‐\npression, regardless of whether tcpdump has read and processed them yet, on other OSes\nit counts only packets that were  matched  by  the  filter  expression  regardless  of\nwhether  tcpdump  has  read  and  processed them yet, and on other OSes it counts only\npackets that were matched by the filter expression and were processed by tcpdump);\n\npackets ``dropped by kernel'' (this is the number of packets that were dropped, due to\na  lack of buffer space, by the packet capture mechanism in the OS on which tcpdump is\nrunning, if the OS reports that information to applications; if not, it  will  be  re‐\nported as 0).\n\nOn  platforms  that support the SIGINFO signal, such as most BSDs (including macOS) and Digi‐\ntal/Tru64 UNIX, it will report those counts when it receives a SIGINFO signal (generated, for\nexample,  by  typing  your  ``status'' character, typically control-T, although on some plat‐\nforms, such as macOS, the ``status'' character is not set by default, so you must set it with\nstty(1)  in  order  to  use it) and will continue capturing packets. On platforms that do not\nsupport the SIGINFO signal, the same can be achieved by using the SIGUSR1 signal.\n\nUsing the SIGUSR2 signal along with the -w flag will forcibly flush the  packet  buffer  into\nthe output file.\n\nReading  packets  from  a network interface may require that you have special privileges; see\nthe pcap(3PCAP) man page for details.  Reading a saved packet file  doesn't  require  special\nprivileges.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-A",
                    "content": "pages.\n",
                    "flag": "-A"
                },
                {
                    "name": "-b",
                    "content": "",
                    "flag": "-b"
                },
                {
                    "name": "-B",
                    "content": "--buffer-size=buffersize\nSet the operating system capture buffer size to buffersize, in  units  of  KiB  (1024\nbytes).\n",
                    "flag": "-B"
                },
                {
                    "name": "-c",
                    "content": "Exit after receiving count packets.\n",
                    "flag": "-c"
                },
                {
                    "name": "--count",
                    "content": "Print  only  on  stderr the packet count when reading capture file(s) instead of pars‐\ning/printing the packets. If a filter is specified on the command line, tcpdump counts\nonly packets that were matched by the filter expression.\n",
                    "long": "--count"
                },
                {
                    "name": "-C",
                    "content": "Before  writing a raw packet to a savefile, check whether the file is currently larger\nthan filesize and, if so, close the current savefile and open a new  one.   Savefiles\nafter  the first savefile will have the name specified with the -w flag, with a number\nafter it, starting at 1 and continuing upward.  The units of filesize are millions of\nbytes (1,000,000 bytes, not 1,048,576 bytes).\n\nNote that when used with -Z option (enabled by default), privileges are dropped before\nopening first savefile.\n",
                    "flag": "-C"
                },
                {
                    "name": "-d",
                    "content": "stop.\n\nPlease mind that although code compilation is always DLT-specific, typically it is im‐\npossible (and unnecessary) to specify which DLT to use for the  dump  because  tcpdump\nuses  either  the  DLT of the input pcap file specified with -r, or the default DLT of\nthe network interface specified with -i, or the particular DLT of the  network  inter‐\nface specified with -y and -i respectively. In these cases the dump shows the same ex‐\nact code that would filter the input file or the network interface without -d.\n\nHowever, when neither -r nor -i is specified,  specifying  -d  prevents  tcpdump  from\nguessing  a  suitable  network  interface  (see -i).  In this case the DLT defaults to\nEN10MB and can be set to another valid value manually with -y.\n",
                    "flag": "-d"
                },
                {
                    "name": "-dd",
                    "content": ""
                },
                {
                    "name": "-ddd",
                    "content": ""
                },
                {
                    "name": "-D",
                    "content": "",
                    "flag": "-D"
                },
                {
                    "name": "--list-interfaces",
                    "content": "Print the list of the network interfaces available on the system and on which  tcpdump\ncan capture packets.  For each network interface, a number and an interface name, pos‐\nsibly followed by a text description of the interface,  are  printed.   The  interface\nname  or the number can be supplied to the -i flag to specify an interface on which to\ncapture.\n\nThis can be useful on systems that don't have a command to list  them  (e.g.,  Windows\nsystems,  or  UNIX  systems  lacking ifconfig -a); the number can be useful on Windows\n2000 and later systems, where the interface name is a somewhat complex string.\n\nThe -D flag will not be supported if tcpdump was built with an older version of  libp‐\ncap that lacks the pcapfindalldevs(3PCAP) function.\n",
                    "long": "--list-interfaces"
                },
                {
                    "name": "-e",
                    "content": "print MAC layer addresses for protocols such as Ethernet and IEEE 802.11.\n",
                    "flag": "-e"
                },
                {
                    "name": "-E",
                    "content": "and  contain Security Parameter Index value spi. This combination may be repeated with\ncomma or newline separation.\n\nNote that setting the secret for IPv4 ESP packets is supported at this time.\n\nAlgorithms may be des-cbc, 3des-cbc, blowfish-cbc, rc3-cbc, cast128-cbc, or none.  The\ndefault  is  des-cbc.   The  ability to decrypt packets is only present if tcpdump was\ncompiled with cryptography enabled.\n\nsecret is the ASCII text for ESP secret key.  If preceded by 0x, then a hex value will\nbe read.\n\nThe  option  assumes  RFC2406  ESP, not RFC1827 ESP.  The option is only for debugging\npurposes, and the use of this option with a true `secret' key is discouraged.  By pre‐\nsenting  IPsec  secret  key onto command line you make it visible to others, via ps(1)\nand other occasions.\n\nIn addition to the above syntax, the syntax file name may be used to have tcpdump read\nthe  provided  file in. The file is opened upon receiving the first ESP packet, so any\nspecial permissions that tcpdump may have been given should already  have  been  given\nup.\n",
                    "flag": "-E"
                },
                {
                    "name": "-f",
                    "content": "intended to get around serious brain damage in Sun's NIS server  —  usually  it  hangs\nforever translating non-local internet numbers).\n\nThe  test  for  `foreign' IPv4 addresses is done using the IPv4 address and netmask of\nthe interface on which capture is being done.  If that  address  or  netmask  are  not\navailable,  available, either because the interface on which capture is being done has\nno address or netmask or because the capture is being done on the Linux  \"any\"  inter‐\nface,  which  can  capture  on more than one interface, this option will not work cor‐\nrectly.\n",
                    "flag": "-f"
                },
                {
                    "name": "-F",
                    "content": "Use file as input for the filter expression.  An additional expression  given  on  the\ncommand line is ignored.\n",
                    "flag": "-F"
                },
                {
                    "name": "-G",
                    "content": "If  specified, rotates the dump file specified with the -w option every rotateseconds\nseconds.  Savefiles will have the name specified by -w which  should  include  a  time\nformat  as defined by strftime(3).  If no time format is specified, each new file will\noverwrite the previous.  Whenever a generated filename is  not  unique,  tcpdump  will\noverwrite  the  pre-existing data; providing a time specification that is coarser than\nthe capture period is therefore not advised.\n\nIf used  in  conjunction  with  the  -C  option,  filenames  will  take  the  form  of\n`file<count>'.\n",
                    "flag": "-G"
                },
                {
                    "name": "-h",
                    "content": "--help Print the tcpdump and libpcap version strings, print a usage message, and exit.\n",
                    "flag": "-h"
                },
                {
                    "name": "--version",
                    "content": "Print the tcpdump and libpcap version strings and exit.\n",
                    "long": "--version"
                },
                {
                    "name": "-H",
                    "content": "",
                    "flag": "-H"
                },
                {
                    "name": "-i",
                    "content": "--interface=interface\nListen,  report  the list of link-layer types, report the list of time stamp types, or\nreport the results of compiling a filter expression on interface.  If unspecified  and\nif the -d flag is not given, tcpdump searches the system interface list for the lowest\nnumbered, configured up interface (excluding loopback), which may turn out to be,  for\nexample, ``eth0''.\n\nOn  Linux  systems  with 2.2 or later kernels, an interface argument of ``any'' can be\nused to capture packets from all interfaces.  Note that captures on the ``any'' device\nwill not be done in promiscuous mode.\n\nIf  the  -D flag is supported, an interface number as printed by that flag can be used\nas the interface argument, if no interface on the system has that number as a name.\n",
                    "flag": "-i"
                },
                {
                    "name": "-I",
                    "content": "",
                    "flag": "-I"
                },
                {
                    "name": "--monitor-mode",
                    "content": "Put the interface in \"monitor mode\"; this is supported only on IEEE 802.11  Wi-Fi  in‐\nterfaces, and supported only on some operating systems.\n\nNote  that  in monitor mode the adapter might disassociate from the network with which\nit's associated, so that you will not be able to use any wireless networks  with  that\nadapter.   This  could  prevent accessing files on a network server, or resolving host\nnames or network addresses, if you are capturing in monitor mode and are not connected\nto another network with another adapter.\n\nThis  flag  will  affect the output of the -L flag.  If -I isn't specified, only those\nlink-layer types available when not in monitor mode will be shown; if -I is specified,\nonly those link-layer types available when in monitor mode will be shown.\n",
                    "long": "--monitor-mode"
                },
                {
                    "name": "--immediate-mode",
                    "content": "Capture  in  \"immediate mode\".  In this mode, packets are delivered to tcpdump as soon\nas they arrive, rather than being buffered for efficiency.  This is the  default  when\nprinting packets rather than saving packets to a ``savefile'' if the packets are being\nprinted to a terminal rather than to a file or pipe.\n",
                    "long": "--immediate-mode"
                },
                {
                    "name": "-j",
                    "content": "--time-stamp-type=tstamptype\nSet the time stamp type for the capture to tstamptype.  The names to use for the time\nstamp types are given in pcap-tstamp(7); not all the types listed there will necessar‐\nily be valid for any given interface.\n",
                    "flag": "-j"
                },
                {
                    "name": "-J",
                    "content": "",
                    "flag": "-J"
                },
                {
                    "name": "--list-time-stamp-types",
                    "content": "List the supported time stamp types for the interface and exit.   If  the  time  stamp\ntype cannot be set for the interface, no time stamp types are listed.\n\n--time-stamp-precision=tstampprecision\nWhen  capturing,  set  the  time  stamp precision for the capture to tstampprecision.\nNote that availability of high precision time stamps (nanoseconds)  and  their  actual\naccuracy  is  platform  and  hardware dependent.  Also note that when writing captures\nmade with nanosecond accuracy to a savefile, the time stamps are written with nanosec‐\nond  resolution,  and  the  file is written with a different magic number, to indicate\nthat the time stamps are in seconds and nanoseconds; not all programs that  read  pcap\nsavefiles will be able to read those captures.\n\nWhen  reading  a  savefile,  convert  time  stamps to the precision specified by time‐\nstampprecision, and display them with that resolution.  If the precision specified is\nless  than  the  precision of time stamps in the file, the conversion will lose preci‐\nsion.\n\nThe supported values for timestampprecision are micro for microsecond resolution  and\nnano for nanosecond resolution.  The default is microsecond resolution.\n",
                    "long": "--list-time-stamp-types"
                },
                {
                    "name": "--micro",
                    "content": "--nano Shorthands  for --time-stamp-precision=micro or --time-stamp-precision=nano, adjusting\nthe time stamp precision accordingly.  When reading packets  from  a  savefile,  using\n--micro  truncates  time stamps if the savefile was created with nanosecond precision.\nIn contrast, a savefile created with microsecond precision will have  trailing  zeroes\nadded to the time stamp when --nano is used.\n",
                    "long": "--micro"
                },
                {
                    "name": "-K",
                    "content": "",
                    "flag": "-K"
                },
                {
                    "name": "--dont-verify-checksums",
                    "content": "Don't attempt to verify IP, TCP, or UDP checksums.  This is useful for interfaces that\nperform some or all of those checksum calculation in hardware; otherwise, all outgoing\nTCP checksums will be flagged as bad.\n",
                    "long": "--dont-verify-checksums"
                },
                {
                    "name": "-l",
                    "content": "E.g.,\n\ntcpdump -l | tee dat\n\nor\n\ntcpdump -l > dat & tail -f dat\n\nNote that on Windows,``line buffered'' means  ``unbuffered'',  so  that  WinDump  will\nwrite each character individually if -l is specified.\n\n-U  is  similar  to  -l  in  its  behavior,  but  it will cause output to be ``packet-\nbuffered'', so that the output is written to stdout at the end of each  packet  rather\nthan at the end of each line; this is buffered on all platforms, including Windows.\n",
                    "flag": "-l"
                },
                {
                    "name": "-L",
                    "content": "",
                    "flag": "-L"
                },
                {
                    "name": "--list-data-link-types",
                    "content": "List  the  known  data  link types for the interface, in the specified mode, and exit.\nThe list of known data link types may be dependent on the specified mode; for example,\non some platforms, a Wi-Fi interface might support one set of data link types when not\nin monitor mode (for example, it might support only fake Ethernet  headers,  or  might\nsupport  802.11 headers but not support 802.11 headers with radio information) and an‐\nother set of data link types when in monitor  mode  (for  example,  it  might  support\n802.11 headers, or 802.11 headers with radio information, only in monitor mode).\n",
                    "long": "--list-data-link-types"
                },
                {
                    "name": "-m",
                    "content": "Load  SMI  MIB  module  definitions from file module.  This option can be used several\ntimes to load several MIB modules into tcpdump.\n",
                    "flag": "-m"
                },
                {
                    "name": "-M",
                    "content": "Use secret as a shared secret for validating the digests found in  TCP  segments  with\nthe TCP-MD5 option (RFC 2385), if present.\n",
                    "flag": "-M"
                },
                {
                    "name": "-n",
                    "content": "",
                    "flag": "-n"
                },
                {
                    "name": "-N",
                    "content": "tcpdump will print ``nic'' instead of ``nic.ddn.mil''.\n\n-#",
                    "flag": "-N"
                },
                {
                    "name": "--number",
                    "content": "Print an optional packet number at the beginning of the line.\n",
                    "long": "--number"
                },
                {
                    "name": "-O",
                    "content": "",
                    "flag": "-O"
                },
                {
                    "name": "--no-optimize",
                    "content": "Do not run the packet-matching code optimizer.  This is useful only if you  suspect  a\nbug in the optimizer.\n",
                    "long": "--no-optimize"
                },
                {
                    "name": "-p",
                    "content": "",
                    "flag": "-p"
                },
                {
                    "name": "--no-promiscuous-mode",
                    "content": "Don't  put  the  interface into promiscuous mode.  Note that the interface might be in\npromiscuous mode for some other reason; hence, `-p' cannot be used as an  abbreviation\nfor `ether host {local-hw-addr} or ether broadcast'.\n",
                    "long": "--no-promiscuous-mode"
                },
                {
                    "name": "--print",
                    "content": "Print parsed packet output, even if the raw packets are being saved to a file with the\n-w flag.\n",
                    "long": "--print"
                },
                {
                    "name": "-Q",
                    "content": "--direction=direction\nChoose send/receive direction direction for which packets should be captured. Possible\nvalues are `in', `out' and `inout'. Not available on all platforms.\n",
                    "flag": "-Q"
                },
                {
                    "name": "-q",
                    "content": "",
                    "flag": "-q"
                },
                {
                    "name": "-r",
                    "content": "Read  packets  from  file (which was created with the -w option or by other tools that\nwrite pcap or pcapng files).  Standard input is used if file is ``-''.\n",
                    "flag": "-r"
                },
                {
                    "name": "-S",
                    "content": "",
                    "flag": "-S"
                },
                {
                    "name": "--absolute-tcp-sequence-numbers",
                    "content": "Print absolute, rather than relative, TCP sequence numbers.\n",
                    "long": "--absolute-tcp-sequence-numbers"
                },
                {
                    "name": "-s",
                    "content": "--snapshot-length=snaplen\nSnarf snaplen bytes of data from each packet rather than the default of 262144  bytes.\nPackets  truncated  because  of  a  limited  snapshot are indicated in the output with\n``[|proto]'', where proto is the name of the protocol level at  which  the  truncation\nhas occurred.\n\nNote  that  taking  larger  snapshots  both  increases  the amount of time it takes to\nprocess packets and, effectively, decreases the amount of packet buffering.  This  may\ncause  packets  to be lost.  Note also that taking smaller snapshots will discard data\nfrom protocols above the transport layer, which loses information that may  be  impor‐\ntant.   NFS and AFS requests and replies, for example, are very large, and much of the\ndetail won't be available if a too-short snapshot length is selected.\n\nIf you need to reduce the snapshot size below the default, you should limit snaplen to\nthe  smallest  number that will capture the protocol information you're interested in.\nSetting snaplen to 0 sets it to the default of  262144,  for  backwards  compatibility\nwith recent older versions of tcpdump.\n",
                    "flag": "-s"
                },
                {
                    "name": "-T",
                    "content": "Force  packets  selected  by  \"expression\" to be interpreted the specified type.  Cur‐\nrently known types are aodv (Ad-hoc On-demand Distance Vector protocol), carp  (Common\nAddress  Redundancy Protocol), cnfp (Cisco NetFlow protocol), domain (Domain Name Sys‐\ntem), lmp (Link Management Protocol), pgm  (Pragmatic  General  Multicast),  pgmzmtp1\n(ZMTP/1.0  inside PGM/EPGM), ptp (Precision Time Protocol), radius (RADIUS), resp (RE‐\ndis Serialization Protocol), rpc (Remote Procedure Call), rtcp (Real-Time Applications\ncontrol protocol), rtp (Real-Time Applications protocol), snmp (Simple Network Manage‐\nment Protocol), someip (SOME/IP), tftp (Trivial File Transfer Protocol),  vat  (Visual\nAudio  Tool),  vxlan  (Virtual  eXtensible  Local Area Network), wb (distributed White\nBoard) and zmtp1 (ZeroMQ Message Transport Protocol 1.0).\n\nNote that the pgm type above affects UDP interpretation only, the native PGM is always\nrecognised  as IP protocol 113 regardless. UDP-encapsulated PGM is often called \"EPGM\"\nor \"PGM/UDP\".\n\nNote that the pgmzmtp1 type above affects interpretation of both native PGM  and  UDP\nat  once. During the native PGM decoding the application data of an ODATA/RDATA packet\nwould be decoded as a ZeroMQ datagram with ZMTP/1.0 frames.  During the  UDP  decoding\nin addition to that any UDP packet would be treated as an encapsulated PGM packet.\n",
                    "flag": "-T"
                },
                {
                    "name": "-t",
                    "content": "",
                    "flag": "-t"
                },
                {
                    "name": "-tt",
                    "content": "a second since that time, on each dump line.\n"
                },
                {
                    "name": "-ttt --time-stamp-pre",
                    "content": "cision  option)  between  current and previous line on each dump line.  The default is\nmicrosecond resolution.\n",
                    "long": "--time-stamp-pre"
                },
                {
                    "name": "-tttt",
                    "content": "night, preceded by the date, on each dump line.\n"
                },
                {
                    "name": "-ttttt --time-stamp-pre",
                    "content": "cision option) between current and first line on each dump line.  The default  is  mi‐\ncrosecond resolution.\n",
                    "long": "--time-stamp-pre"
                },
                {
                    "name": "-u",
                    "content": "",
                    "flag": "-u"
                },
                {
                    "name": "-U",
                    "content": "",
                    "flag": "-U"
                },
                {
                    "name": "--packet-buffered",
                    "content": "If  the -w option is not specified, or if it is specified but the --print flag is also\nspecified, make the printed packet output ``packet-buffered''; i.e., as  the  descrip‐\ntion  of  the  contents  of each packet is printed, it will be written to the standard\noutput, rather than, when not writing to a terminal, being written only when the  out‐\nput buffer fills.\n\nIf  the  -w option is specified, make the saved raw packet output ``packet-buffered'';\ni.e., as each packet is saved, it will be written to the output file, rather than  be‐\ning written only when the output buffer fills.\n\nThe  -U flag will not be supported if tcpdump was built with an older version of libp‐\ncap that lacks the pcapdumpflush(3PCAP) function.\n",
                    "long": "--packet-buffered"
                },
                {
                    "name": "-v",
                    "content": "time  to  live,  identification, total length and options in an IP packet are printed.\nAlso enables additional packet integrity checks such as  verifying  the  IP  and  ICMP\nheader checksum.\n\nWhen writing to a file with the -w option and at the same time not reading from a file\nwith the -r option, report to stderr, once per second, the number of packets captured.\nIn  Solaris,  FreeBSD  and  possibly other operating systems this periodic update cur‐\nrently can cause loss of captured packets on their way from the kernel to tcpdump.\n",
                    "flag": "-v"
                },
                {
                    "name": "-vv",
                    "content": "packets, and SMB packets are fully decoded.\n"
                },
                {
                    "name": "-vvv",
                    "content": "With -X Telnet options are printed in hex as well.\n"
                },
                {
                    "name": "-V",
                    "content": "Read a list of filenames from file. Standard input is used if file is ``-''.\n",
                    "flag": "-V"
                },
                {
                    "name": "-w",
                    "content": "Write the raw packets to file rather than parsing and printing  them  out.   They  can\nlater be printed with the -r option.  Standard output is used if file is ``-''.\n\nThis  output  will be buffered if written to a file or pipe, so a program reading from\nthe file or pipe may not see packets for an arbitrary amount of time  after  they  are\nreceived.   Use  the  -U  flag  to cause packets to be written as soon as they are re‐\nceived.\n\nThe MIME type application/vnd.tcpdump.pcap has been  registered  with  IANA  for  pcap\nfiles.  The  filename  extension .pcap appears to be the most commonly used along with\n.cap and .dmp. Tcpdump itself doesn't check the extension when reading  capture  files\nand  doesn't  add  an  extension  when writing them (it uses magic numbers in the file\nheader instead). However, many operating systems and applications will use the  exten‐\nsion if it is present and adding one (e.g. .pcap) is recommended.\n\nSee pcap-savefile(5) for a description of the file format.\n",
                    "flag": "-w"
                },
                {
                    "name": "-W",
                    "content": "Used in conjunction with the -C option, this will limit the number of files created to\nthe specified number, and begin overwriting files from the beginning, thus creating  a\n'rotating' buffer.  In addition, it will name the files with enough leading 0s to sup‐\nport the maximum number of files, allowing them to sort correctly.\n\nUsed in conjunction with the -G option, this will limit the  number  of  rotated  dump\nfiles that get created, exiting with status 0 when reaching the limit.\n\nIf  used  in conjunction with both -C and -G, the -W option will currently be ignored,\nand will only affect the file name.\n",
                    "flag": "-W"
                },
                {
                    "name": "-x",
                    "content": "the  data of each packet (minus its link level header) in hex.  The smaller of the en‐\ntire packet or snaplen bytes will be printed.  Note that this is the entire link-layer\npacket,  so  for  link layers that pad (e.g. Ethernet), the padding bytes will also be\nprinted when the higher layer packet is shorter than the  required  padding.   In  the\ncurrent  implementation  this  flag  may  have the same effect as -xx if the packet is\ntruncated.\n",
                    "flag": "-x"
                },
                {
                    "name": "-xx",
                    "content": "the data of each packet, including its link level header, in hex.\n"
                },
                {
                    "name": "-X",
                    "content": "the data of each packet (minus its link level header) in hex and ASCII.  This is  very\nhandy  for  analysing new protocols.  In the current implementation this flag may have\nthe same effect as -XX if the packet is truncated.\n",
                    "flag": "-X"
                },
                {
                    "name": "-XX",
                    "content": "the data of each packet, including its link level header, in hex and ASCII.\n"
                },
                {
                    "name": "-y",
                    "content": "--linktype=datalinktype\nSet  the  data link type to use while capturing packets (see -L) or just compiling and\ndumping packet-matching code (see -d) to datalinktype.\n",
                    "flag": "-y"
                },
                {
                    "name": "-z",
                    "content": "Used in conjunction with the -C or -G options, this will make tcpdump  run  \"  postro‐\ntate-command  file  \" where file is the savefile being closed after each rotation. For\nexample, specifying -z gzip or -z bzip2 will compress  each  savefile  using  gzip  or\nbzip2.\n\nNote  that  tcpdump  will run the command in parallel to the capture, using the lowest\npriority so that this doesn't disturb the capture process.\n\nAnd in case you would like to use a command that itself takes flags or different argu‐\nments,  you  can  always  write a shell script that will take the savefile name as the\nonly argument, make the flags & arguments arrangements and execute  the  command  that\nyou want.\n",
                    "flag": "-z"
                },
                {
                    "name": "-Z",
                    "content": "--relinquish-privileges=user\nIf  tcpdump  is  running  as root, after opening the capture device or input savefile,\nchange the user ID to user and the group ID to the primary group of user.\n\nThis behavior is enabled by default (-Z tcpdump), and can be disabled by -Z root.\n\n\nexpression\nselects which packets will be dumped.  If no expression is given, all packets  on  the\nnet  will  be  dumped.  Otherwise, only packets for which expression is `true' will be\ndumped.\n\nFor the expression syntax, see pcap-filter(7).\n\nThe expression argument can be passed to tcpdump as either a single Shell argument, or\nas  multiple Shell arguments, whichever is more convenient.  Generally, if the expres‐\nsion contains Shell metacharacters, such as backslashes used to escape protocol names,\nit  is  easier to pass it as a single, quoted argument rather than to escape the Shell\nmetacharacters.  Multiple arguments are concatenated with spaces before being parsed.\n",
                    "flag": "-Z"
                }
            ]
        },
        "EXAMPLES": {
            "content": "To print all packets arriving at or departing from sundown:\ntcpdump host sundown\n\nTo print traffic between helios and either hot or ace:\ntcpdump host helios and \\( hot or ace \\)\n\nTo print all IP packets between ace and any host except helios:\ntcpdump ip host ace and not helios\n\nTo print all traffic between local hosts and hosts at Berkeley:\ntcpdump net ucb-ether\n\nTo print all ftp traffic through internet gateway snup: (note that the expression  is  quoted\nto prevent the shell from (mis-)interpreting the parentheses):\ntcpdump 'gateway snup and (port ftp or ftp-data)'\n\nTo  print  traffic  neither  sourced from nor destined for local hosts (if you gateway to one\nother net, this stuff should never make it onto your local net).\ntcpdump ip and not net localnet\n\nTo print the start and end packets (the SYN and FIN packets) of each  TCP  conversation  that\ninvolves a non-local host.\ntcpdump 'tcp[tcpflags] & (tcp-syn|tcp-fin) != 0 and not src and dst net localnet'\n\nTo  print the TCP packets with flags RST and ACK both set.  (i.e. select only the RST and ACK\nflags in the flags field, and if the result is \"RST and ACK both set\", match)\ntcpdump 'tcp[tcpflags] & (tcp-rst|tcp-ack) == (tcp-rst|tcp-ack)'\n\nTo print all IPv4 HTTP packets to and from port 80, i.e.  print  only  packets  that  contain\ndata,  not, for example, SYN and FIN packets and ACK-only packets.  (IPv6 is left as an exer‐\ncise for the reader.)\ntcpdump 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'\n\nTo print IP packets longer than 576 bytes sent through gateway snup:\ntcpdump 'gateway snup and ip[2:2] > 576'\n\nTo print IP broadcast or multicast packets that were not sent via Ethernet broadcast or  mul‐\nticast:\ntcpdump 'ether[0] & 1 = 0 and ip[16] >= 224'\n\nTo print all ICMP packets that are not echo requests/replies (i.e., not ping packets):\ntcpdump 'icmp[icmptype] != icmp-echo and icmp[icmptype] != icmp-echoreply'\n",
            "subsections": []
        },
        "OUTPUT FORMAT": {
            "content": "The output of tcpdump is protocol dependent.  The following gives a brief description and ex‐\namples of most of the formats.\n",
            "subsections": [
                {
                    "name": "Timestamps",
                    "content": "By default, all output lines are preceded by a timestamp.  The timestamp is the current clock\ntime in the form\nhh:mm:ss.frac\nand is as accurate as the kernel's clock.  The timestamp reflects the time the kernel applied\na time stamp to the packet.  No attempt is made to account for the time lag between when  the\nnetwork  interface finished receiving the packet from the network and when the kernel applied\na time stamp to the packet; that time lag could include a delay between  the  time  when  the\nnetwork interface finished receiving a packet from the network and the time when an interrupt\nwas delivered to the kernel to get it to read the packet and a delay between  the  time  when\nthe  kernel  serviced the `new packet' interrupt and the time when it applied a time stamp to\nthe packet.\n"
                },
                {
                    "name": "Link Level Headers",
                    "content": "If the '-e' option is given, the link level header is printed out.  On Ethernets, the  source\nand destination addresses, protocol, and packet length are printed.\n\nOn  FDDI  networks,  the  '-e' option causes tcpdump to print the `frame control' field,  the\nsource and destination addresses, and the packet length.  (The `frame control' field  governs\nthe  interpretation  of  the rest of the packet.  Normal packets (such as those containing IP\ndatagrams) are `async' packets, with a priority value between 0 and 7; for example, `async4'.\nSuch  packets  are  assumed  to  contain  an 802.2 Logical Link Control (LLC) packet; the LLC\nheader is printed if it is not an ISO datagram or a so-called SNAP packet.\n\nOn Token Ring networks, the '-e' option causes tcpdump to  print  the  `access  control'  and\n`frame  control'  fields, the source and destination addresses, and the packet length.  As on\nFDDI networks, packets are assumed to contain an LLC packet.  Regardless of whether the  '-e'\noption is specified or not, the source routing information is printed for source-routed pack‐\nets.\n\nOn 802.11 networks, the '-e' option causes tcpdump to print the `frame control'  fields,  all\nof  the  addresses in the 802.11 header, and the packet length.  As on FDDI networks, packets\nare assumed to contain an LLC packet.\n\n(N.B.: The following description assumes familiarity with the SLIP compression algorithm  de‐\nscribed in RFC-1144.)\n\nOn  SLIP  links,  a direction indicator (``I'' for inbound, ``O'' for outbound), packet type,\nand compression information are printed out.  The packet type is printed  first.   The  three\ntypes  are  ip,  utcp, and ctcp.  No further link information is printed for ip packets.  For\nTCP packets, the connection identifier is printed following the type.  If the packet is  com‐\npressed,  its  encoded  header is printed out.  The special cases are printed out as *S+n and\n*SA+n, where n is the amount by which the sequence number (or sequence number  and  ack)  has\nchanged.   If  it is not a special case, zero or more changes are printed.  A change is indi‐\ncated by U (urgent pointer), W (window), A (ack), S (sequence number),  and  I  (packet  ID),\nfollowed  by  a  delta  (+n  or -n), or a new value (=n).  Finally, the amount of data in the\npacket and compressed header length are printed.\n\nFor example, the following line shows an outbound compressed TCP  packet,  with  an  implicit\nconnection identifier; the ack has changed by 6, the sequence number by 49, and the packet ID\nby 6; there are 3 bytes of data and 6 bytes of compressed header:\nO ctcp * A+6 S+49 I+6 3 (6)\n"
                },
                {
                    "name": "ARP/RARP Packets",
                    "content": "ARP/RARP output shows the type of request and its arguments.  The format is  intended  to  be\nself  explanatory.  Here is a short sample taken from the start of an `rlogin' from host rtsg\nto host csam:\narp who-has csam tell rtsg\narp reply csam is-at CSAM\nThe first line says that rtsg sent an ARP packet asking for the Ethernet address of  internet\nhost  csam.   Csam replies with its Ethernet address (in this example, Ethernet addresses are\nin caps and internet addresses in lower case).\n\nThis would look less redundant if we had done tcpdump -n:\narp who-has 128.3.254.6 tell 128.3.254.68\narp reply 128.3.254.6 is-at 02:07:01:00:01:c4\n\nIf we had done tcpdump -e, the fact that the first packet is  broadcast  and  the  second  is\npoint-to-point would be visible:\nRTSG Broadcast 0806  64: arp who-has csam tell rtsg\nCSAM RTSG 0806  64: arp reply csam is-at CSAM\nFor  the  first  packet this says the Ethernet source address is RTSG, the destination is the\nEthernet broadcast address, the type field contained hex 0806 (type ETHERARP) and the  total\nlength was 64 bytes.\n"
                },
                {
                    "name": "IPv4 Packets",
                    "content": "If the link-layer header is not being printed, for IPv4 packets, IP is printed after the time\nstamp.\n\nIf the -v flag is specified, information from the IPv4 header is shown in  parentheses  after\nthe IP or the link-layer header.  The general format of this information is:\ntos tos, ttl ttl, id id, offset offset, flags [flags], proto proto, length length, options (options)\ntos is the type of service field; if the ECN bits are non-zero, those are reported as ECT(1),\nECT(0), or CE.  ttl is the time-to-live; it is not reported if it is  zero.   id  is  the  IP\nidentification  field.   offset  is  the fragment offset field; it is printed whether this is\npart of a fragmented datagram or not.  flags are the MF and DF flags; + is reported if MF  is\nset, and DF is reported if F is set.  If neither are set, . is reported.  proto is the proto‐\ncol ID field.  length is the total length field.  options are the IP options, if any.\n\nNext, for TCP and UDP packets, the source and destination IP addresses and TCP or UDP  ports,\nwith a dot between each IP address and its corresponding port, will be printed, with a > sep‐\narating the source and destination.  For other protocols, the addresses will be printed, with\na  >  separating the source and destination.  Higher level protocol information, if any, will\nbe printed after that.\n\nFor fragmented IP datagrams, the first fragment contains the higher  level  protocol  header;\nfragments after the first contain no higher level protocol header.  Fragmentation information\nwill be printed only with the -v flag, in the IP header information, as described above.\n"
                },
                {
                    "name": "TCP Packets",
                    "content": "(N.B.:The following description assumes  familiarity  with  the  TCP  protocol  described  in\nRFC-793.  If you are not familiar with the protocol, this description will not be of much use\nto you.)\n\nThe general format of a TCP protocol line is:\nsrc > dst: Flags [tcpflags], seq data-seqno, ack ackno, win window, urg urgent, options [opts], length len\nSrc and dst are the source and destination IP addresses and ports.  Tcpflags are some  combi‐\nnation  of  S  (SYN),  F  (FIN), P (PUSH), R (RST), U (URG), W (ECN CWR), E (ECN-Echo) or `.'\n(ACK), or `none' if no flags are set.  Data-seqno describes the  portion  of  sequence  space\ncovered by the data in this packet (see example below).  Ackno is sequence number of the next\ndata expected the other direction on this connection.  Window is the number of bytes  of  re‐\nceive  buffer space available the other direction on this connection.  Urg indicates there is\n`urgent' data in the packet.  Opts are TCP options (e.g., mss 1024).  Len is  the  length  of\npayload data.\n\nIptype,  Src,  dst, and flags are always present.  The other fields depend on the contents of\nthe packet's TCP protocol header and are output only if appropriate.\n\nHere is the opening portion of an rlogin from host rtsg to host csam.\nIP rtsg.1023 > csam.login: Flags [S], seq 768512:768512, win 4096, opts [mss 1024]\nIP csam.login > rtsg.1023: Flags [S.], seq, 947648:947648, ack 768513, win 4096, opts [mss 1024]\nIP rtsg.1023 > csam.login: Flags [.], ack 1, win 4096\nIP rtsg.1023 > csam.login: Flags [P.], seq 1:2, ack 1, win 4096, length 1\nIP csam.login > rtsg.1023: Flags [.], ack 2, win 4096\nIP rtsg.1023 > csam.login: Flags [P.], seq 2:21, ack 1, win 4096, length 19\nIP csam.login > rtsg.1023: Flags [P.], seq 1:2, ack 21, win 4077, length 1\nIP csam.login > rtsg.1023: Flags [P.], seq 2:3, ack 21, win 4077, urg 1, length 1\nIP csam.login > rtsg.1023: Flags [P.], seq 3:4, ack 21, win 4077, urg 1, length 1\nThe first line says that TCP port 1023 on rtsg sent a packet to port login on  csam.   The  S\nindicates  that the SYN flag was set.  The packet sequence number was 768512 and it contained\nno data.  (The notation is `first:last' which means `sequence numbers first up to but not in‐\ncluding  last'.)   There was no piggy-backed ACK, the available receive window was 4096 bytes\nand there was a max-segment-size option requesting an MSS of 1024 bytes.\n\nCsam replies with a similar packet except it includes a  piggy-backed  ACK  for  rtsg's  SYN.\nRtsg then ACKs csam's SYN.  The `.' means the ACK flag was set.  The packet contained no data\nso there is no data sequence number or length.  Note that the ACK sequence number is a  small\ninteger (1).  The first time tcpdump sees a TCP `conversation', it prints the sequence number\nfrom the packet.  On subsequent packets of the conversation, the difference between the  cur‐\nrent  packet's  sequence number and this initial sequence number is printed.  This means that\nsequence numbers after the first can be interpreted as relative byte positions in the conver‐\nsation's data stream (with the first data byte each direction being `1').  `-S' will override\nthis feature, causing the original sequence numbers to be output.\n\nOn the 6th line, rtsg sends csam 19 bytes of data (bytes 2 through 20 in the rtsg → csam side\nof  the  conversation).  The PUSH flag is set in the packet.  On the 7th line, csam says it's\nreceived data sent by rtsg up to but not including byte 21.  Most of this data is  apparently\nsitting  in  the socket buffer since csam's receive window has gotten 19 bytes smaller.  Csam\nalso sends one byte of data to rtsg in this packet.  On the 8th and 9th lines, csam sends two\nbytes of urgent, pushed data to rtsg.\n\nIf  the  snapshot was small enough that tcpdump didn't capture the full TCP header, it inter‐\nprets as much of the header as it can and then reports ``[|tcp]'' to indicate  the  remainder\ncould  not  be  interpreted.  If the header contains a bogus option (one with a length that's\neither too small or beyond the end of the header), tcpdump reports it as  ``[bad  opt]''  and\ndoes  not interpret any further options (since it's impossible to tell where they start).  If\nthe header length indicates options are present but the IP datagram length is not long enough\nfor the options to actually be there, tcpdump reports it as ``[bad hdr length]''.\n"
                },
                {
                    "name": "Capturing TCP packets with particular flag combinations (SYN-ACK, URG-ACK, etc.)",
                    "content": "There are 8 bits in the control bits section of the TCP header:\n\nCWR | ECE | URG | ACK | PSH | RST | SYN | FIN\n\nLet's  assume  that  we  want to watch packets used in establishing a TCP connection.  Recall\nthat TCP uses a 3-way handshake protocol when it initializes a new connection; the connection\nsequence with regard to the TCP control bits is\n\n1) Caller sends SYN\n2) Recipient responds with SYN, ACK\n3) Caller sends ACK\n\nNow we're interested in capturing packets that have only the SYN bit set (Step 1).  Note that\nwe don't want packets from step 2 (SYN-ACK), just a plain initial SYN.  What  we  need  is  a\ncorrect filter expression for tcpdump.\n\nRecall the structure of a TCP header without options:\n\n0                            15                              31\n-----------------------------------------------------------------\n|          source port          |       destination port        |\n-----------------------------------------------------------------\n|                        sequence number                        |\n-----------------------------------------------------------------\n|                     acknowledgment number                     |\n-----------------------------------------------------------------\n|  HL   | rsvd  |C|E|U|A|P|R|S|F|        window size            |\n-----------------------------------------------------------------\n|         TCP checksum          |       urgent pointer          |\n-----------------------------------------------------------------\n\nA  TCP header usually holds 20 octets of data, unless options are present.  The first line of\nthe graph contains octets 0 - 3, the second line shows octets 4 - 7 etc.\n\nStarting to count with 0, the relevant TCP control bits are contained in octet 13:\n\n0             7|             15|             23|             31\n----------------|---------------|---------------|----------------\n|  HL   | rsvd  |C|E|U|A|P|R|S|F|        window size            |\n----------------|---------------|---------------|----------------\n|               |  13th octet   |               |               |\n\nLet's have a closer look at octet no. 13:\n\n|               |\n|---------------|\n|C|E|U|A|P|R|S|F|\n|---------------|\n|7   5   3     0|\n\nThese are the TCP control bits we are interested in.  We have numbered the bits in this octet\nfrom 0 to 7, right to left, so the PSH bit is bit number 3, while the URG bit is number 5.\n\nRecall that we want to capture packets with only SYN set.  Let's see what happens to octet 13\nif a TCP datagram arrives with the SYN bit set in its header:\n\n|C|E|U|A|P|R|S|F|\n|---------------|\n|0 0 0 0 0 0 1 0|\n|---------------|\n|7 6 5 4 3 2 1 0|\n\nLooking at the control bits section we see that only bit number 1 (SYN) is set.\n\nAssuming that octet number 13 is an 8-bit unsigned integer in network byte order, the  binary\nvalue of this octet is\n\n00000010\n\nand its decimal representation is\n\n7     6     5     4     3     2     1     0\n0*2 + 0*2 + 0*2 + 0*2 + 0*2 + 0*2 + 1*2 + 0*2  =  2\n\nWe're  almost  done, because now we know that if only SYN is set, the value of the 13th octet\nin the TCP header, when interpreted as a 8-bit unsigned integer in network byte  order,  must\nbe exactly 2.\n\nThis relationship can be expressed as\ntcp[13] == 2\n\nWe  can  use  this  expression as the filter for tcpdump in order to watch packets which have\nonly SYN set:\ntcpdump -i xl0 tcp[13] == 2\n\nThe expression says \"let the 13th octet of a TCP datagram have the decimal value 2\", which is\nexactly what we want.\n\nNow,  let's assume that we need to capture SYN packets, but we don't care if ACK or any other\nTCP control bit is set at the same time.  Let's see what happens to octet 13 when a TCP data‐\ngram with SYN-ACK set arrives:\n\n|C|E|U|A|P|R|S|F|\n|---------------|\n|0 0 0 1 0 0 1 0|\n|---------------|\n|7 6 5 4 3 2 1 0|\n\nNow bits 1 and 4 are set in the 13th octet.  The binary value of octet 13 is\n\n00010010\n\nwhich translates to decimal\n\n7     6     5     4     3     2     1     0\n0*2 + 0*2 + 0*2 + 1*2 + 0*2 + 0*2 + 1*2 + 0*2   = 18\n\nNow  we  can't  just use 'tcp[13] == 18' in the tcpdump filter expression, because that would\nselect only those packets that have SYN-ACK set, but not those with only SYN  set.   Remember\nthat we don't care if ACK or any other control bit is set as long as SYN is set.\n\nIn order to achieve our goal, we need to logically AND the binary value of octet 13 with some\nother value to preserve the SYN bit.  We know that we want SYN to be  set  in  any  case,  so\nwe'll logically AND the value in the 13th octet with the binary value of a SYN:\n\n00010010 SYN-ACK              00000010 SYN\nAND  00000010 (we want SYN)   AND  00000010 (we want SYN)\n--------                      --------\n=    00000010                 =    00000010\n\nWe see that this AND operation delivers the same result regardless whether ACK or another TCP\ncontrol bit is set.  The decimal representation of the AND value as well  as  the  result  of\nthis operation is 2 (binary 00000010), so we know that for packets with SYN set the following\nrelation must hold true:\n\n( ( value of octet 13 ) AND ( 2 ) ) == ( 2 )\n\nThis points us to the tcpdump filter expression\ntcpdump -i xl0 'tcp[13] & 2 == 2'\n\nSome offsets and field values may be expressed as names rather than as  numeric  values.  For\nexample  tcp[13]  may be replaced with tcp[tcpflags]. The following TCP flag field values are\nalso available: tcp-fin, tcp-syn, tcp-rst, tcp-push, tcp-ack, tcp-urg.\n\nThis can be demonstrated as:\ntcpdump -i xl0 'tcp[tcpflags] & tcp-push != 0'\n\nNote that you should use single quotes or a backslash in the expression to hide the AND ('&')\nspecial character from the shell.\n"
                },
                {
                    "name": "UDP Packets",
                    "content": "UDP format is illustrated by this rwho packet:\nactinide.who > broadcast.who: udp 84\nThis  says  that port who on host actinide sent a UDP datagram to port who on host broadcast,\nthe Internet broadcast address.  The packet contained 84 bytes of user data.\n\nSome UDP services are recognized (from the source or destination port number) and the  higher\nlevel   protocol   information   printed.    In  particular,  Domain  Name  service  requests\n(RFC-1034/1035) and Sun RPC calls (RFC-1050) to NFS.\n"
                },
                {
                    "name": "TCP or UDP Name Server Requests",
                    "content": "(N.B.:The following description assumes familiarity with  the  Domain  Service  protocol  de‐\nscribed  in  RFC-1035.   If you are not familiar with the protocol, the following description\nwill appear to be written in Greek.)\n\nName server requests are formatted as\nsrc > dst: id op? flags qtype qclass name (len)\nh2opolo.1538 > helios.domain: 3+ A? ucbvax.berkeley.edu. (37)\nHost h2opolo asked the domain server on helios for an  address  record  (qtype=A)  associated\nwith  the  name  ucbvax.berkeley.edu.  The query id was `3'.  The `+' indicates the recursion\ndesired flag was set.  The query length was 37 bytes, excluding the TCP or UDP and IP  proto‐\ncol headers.  The query operation was the normal one, Query, so the op field was omitted.  If\nthe op had been anything else, it would have been printed between the `3' and the `+'.  Simi‐\nlarly,  the  qclass  was the normal one, CIN, and omitted.  Any other qclass would have been\nprinted immediately after the `A'.\n\nA few anomalies are checked and may result in extra fields enclosed in square brackets:  If a\nquery  contains an answer, authority records or additional records section, ancount, nscount,\nor arcount are printed as `[na]', `[nn]' or  `[nau]' where n is the  appropriate  count.   If\nany  of the response bits are set (AA, RA or rcode) or any of the `must be zero' bits are set\nin bytes two and three, `[b2&3=x]' is printed, where x is the hex value of header  bytes  two\nand three.\n"
                },
                {
                    "name": "TCP or UDP Name Server Responses",
                    "content": "Name server responses are formatted as\nsrc > dst:  id op rcode flags a/n/au type class data (len)\nhelios.domain > h2opolo.1538: 3 3/3/7 A 128.32.137.3 (273)\nhelios.domain > h2opolo.1537: 2 NXDomain* 0/1/0 (97)\nIn  the  first  example,  helios responds to query id 3 from h2opolo with 3 answer records, 3\nname server records and 7 additional records.  The first answer record is  type  A  (address)\nand its data is internet address 128.32.137.3.  The total size of the response was 273 bytes,\nexcluding TCP or UDP and IP headers.  The op (Query) and response code (NoError)  were  omit‐\nted, as was the class (CIN) of the A record.\n\nIn the second example, helios responds to query 2 with a response code of non-existent domain\n(NXDomain) with no answers, one name server and no authority records.  The `*' indicates that\nthe  authoritative  answer  bit was set.  Since there were no answers, no type, class or data\nwere printed.\n\nOther flag characters that might appear are `-' (recursion available, RA, not  set)  and  `|'\n(truncated  message,  TC, set).  If the `question' section doesn't contain exactly one entry,\n`[nq]' is printed.\n"
                },
                {
                    "name": "SMB/CIFS decoding",
                    "content": "tcpdump now includes fairly extensive SMB/CIFS/NBT decoding for data on UDP/137, UDP/138  and\nTCP/139.  Some primitive decoding of IPX and NetBEUI SMB data is also done.\n\nBy  default  a  fairly minimal decode is done, with a much more detailed decode done if -v is\nused.  Be warned that with -v a single SMB packet may take up a page or more, so only use  -v\nif you really want all the gory details.\n\nFor   information   on   SMB   packet   formats   and   what   all   the   fields   mean  see\nhttps://download.samba.org/pub/samba/specs/ and other online resources.  The SMB patches were\nwritten by Andrew Tridgell (tridge@samba.org).\n"
                },
                {
                    "name": "NFS Requests and Replies",
                    "content": "Sun NFS (Network File System) requests and replies are printed as:\nsrc.sport > dst.nfs: NFS request xid xid len op args\nsrc.nfs > dst.dport: NFS reply xid xid reply stat len op results\nsushi.1023 > wrl.nfs: NFS request xid 26377\n112 readlink fh 21,24/10.73165\nwrl.nfs > sushi.1023: NFS reply xid 26377\nreply ok 40 readlink \"../var\"\nsushi.1022 > wrl.nfs: NFS request xid 8219\n144 lookup fh 9,74/4096.6878 \"xcolors\"\nwrl.nfs > sushi.1022: NFS reply xid 8219\nreply ok 128 lookup fh 9,74/4134.3150\nIn  the first line, host sushi sends a transaction with id 26377 to wrl.  The request was 112\nbytes, excluding the UDP and IP headers.  The operation was a readlink (read  symbolic  link)\non  file  handle (fh) 21,24/10.731657119.  (If one is lucky, as in this case, the file handle\ncan be interpreted as a major,minor device number pair, followed by the inode number and gen‐\neration  number.)  In  the second line, wrl replies `ok' with the same transaction id and the\ncontents of the link.\n\nIn the third line, sushi asks (using a new transaction id) wrl to lookup the  name  `xcolors'\nin  directory  file 9,74/4096.6878. In the fourth line, wrl sends a reply with the respective\ntransaction id.\n\nNote that the data printed depends on the operation type.  The format is intended to be  self\nexplanatory  if read in conjunction with an NFS protocol spec.  Also note that older versions\nof tcpdump printed NFS packets in a slightly different format: the transaction id (xid) would\nbe printed instead of the non-NFS port number of the packet.\n\nIf the -v (verbose) flag is given, additional information is printed.  For example:\nsushi.1023 > wrl.nfs: NFS request xid 79658\n148 read fh 21,11/12.195 8192 bytes @ 24576\nwrl.nfs > sushi.1023: NFS reply xid 79658\nreply ok 1472 read REG 100664 ids 417/0 sz 29388\n(-v  also  prints  the  IP  header TTL, ID, length, and fragmentation fields, which have been\nomitted from this example.)  In the first line, sushi asks wrl to read 8192 bytes  from  file\n21,11/12.195, at byte offset 24576.  Wrl replies `ok'; the packet shown on the second line is\nthe first fragment of the reply, and hence is only 1472 bytes long (the other bytes will fol‐\nlow  in  subsequent fragments, but these fragments do not have NFS or even UDP headers and so\nmight not be printed, depending on the filter expression  used).   Because  the  -v  flag  is\ngiven,  some  of  the  file  attributes (which are returned in addition to the file data) are\nprinted: the file type (``REG'', for regular file), the file mode (in  octal),  the  UID  and\nGID, and the file size.\n\nIf the -v flag is given more than once, even more details are printed.\n\nNFS reply packets do not explicitly identify the RPC operation.  Instead, tcpdump keeps track\nof ``recent'' requests, and matches them to the replies using the transaction ID.  If a reply\ndoes not closely follow the corresponding request, it might not be parsable.\n"
                },
                {
                    "name": "AFS Requests and Replies",
                    "content": "Transarc AFS (Andrew File System) requests and replies are printed as:\n\nsrc.sport > dst.dport: rx packet-type\nsrc.sport > dst.dport: rx packet-type service call call-name args\nsrc.sport > dst.dport: rx packet-type service reply call-name args\nelvis.7001 > pike.afsfs:\nrx data fs call rename old fid 536876964/1/1 \".newsrc.new\"\nnew fid 536876964/1/1 \".newsrc\"\npike.afsfs > elvis.7001: rx data fs reply rename\nIn the first line, host elvis sends a RX packet to pike.  This was a RX data packet to the fs\n(fileserver) service, and is the start of an RPC call.  The RPC call was a rename,  with  the\nold directory file id of 536876964/1/1 and an old filename of `.newsrc.new', and a new direc‐\ntory file id of 536876964/1/1 and a new filename of `.newsrc'.  The host pike responds with a\nRPC  reply  to the rename call (which was successful, because it was a data packet and not an\nabort packet).\n\nIn general, all AFS RPCs are decoded at least by RPC call name.  Most AFS RPCs have at  least\nsome  of  the arguments decoded (generally only the `interesting' arguments, for some defini‐\ntion of interesting).\n\nThe format is intended to be self-describing, but it will probably not be  useful  to  people\nwho are not familiar with the workings of AFS and RX.\n\nIf the -v (verbose) flag is given twice, acknowledgement packets and additional header infor‐\nmation is printed, such as the RX call ID, call number, sequence number, serial  number,  and\nthe RX packet flags.\n\nIf the -v flag is given twice, additional information is printed, such as the RX call ID, se‐\nrial number, and the RX packet flags.  The MTU negotiation information is also  printed  from\nRX ack packets.\n\nIf the -v flag is given three times, the security index and service id are printed.\n\nError codes are printed for abort packets, with the exception of Ubik beacon packets (because\nabort packets are used to signify a yes vote for the Ubik protocol).\n\nAFS reply packets do not explicitly identify the RPC operation.  Instead, tcpdump keeps track\nof ``recent'' requests, and matches them to the replies using the call number and service ID.\nIf a reply does not closely follow the corresponding request, it might not be parsable.\n\n"
                },
                {
                    "name": "KIP AppleTalk (DDP in UDP)",
                    "content": "AppleTalk DDP packets encapsulated in UDP datagrams are de-encapsulated  and  dumped  as  DDP\npackets  (i.e.,  all  the UDP header information is discarded).  The file /etc/atalk.names is\nused to translate AppleTalk net and node numbers to names.  Lines in this file have the form\nnumber    name\n\n1.254          ether\n16.1      icsd-net\n1.254.110 ace\nThe first two lines give the names of AppleTalk networks.  The third line gives the name of a\nparticular  host  (a  host is distinguished from a net by the 3rd octet in the number - a net\nnumber must have two octets and a host number must have three octets.)  The number  and  name\nshould  be  separated  by whitespace (blanks or tabs).  The /etc/atalk.names file may contain\nblank lines or comment lines (lines starting with a `#').\n\nAppleTalk addresses are printed in the form\nnet.host.port\n\n144.1.209.2 > icsd-net.112.220\noffice.2 > icsd-net.112.220\njssmag.149.235 > icsd-net.2\n(If the /etc/atalk.names doesn't exist  or  doesn't  contain  an  entry  for  some  AppleTalk\nhost/net number, addresses are printed in numeric form.)  In the first example, NBP (DDP port\n2) on net 144.1 node 209 is sending to whatever is listening on port 220  of  net  icsd  node\n112.   The  second  line  is  the same except the full name of the source node is known (`of‐\nfice').  The third line is a send from port 235 on net jssmag node 149 to  broadcast  on  the\nicsd-net  NBP  port (note that the broadcast address (255) is indicated by a net name with no\nhost number - for this reason it's a good idea to keep node names and net names  distinct  in\n/etc/atalk.names).\n\nNBP  (name binding protocol) and ATP (AppleTalk transaction protocol) packets have their con‐\ntents interpreted.  Other protocols just dump the protocol name (or number if no name is reg‐\nistered for the protocol) and packet size.\n\nNBP packets are formatted like the following examples:\nicsd-net.112.220 > jssmag.2: nbp-lkup 190: \"=:LaserWriter@*\"\njssmag.209.2 > icsd-net.112.220: nbp-reply 190: \"RM1140:LaserWriter@*\" 250\ntechpit.2 > icsd-net.112.220: nbp-reply 190: \"techpit:LaserWriter@*\" 186\nThe first line is a name lookup request for laserwriters sent by net icsd host 112 and broad‐\ncast on net jssmag.  The nbp id for the lookup is 190.  The second line  shows  a  reply  for\nthis  request (note that it has the same id) from host jssmag.209 saying that it has a laser‐\nwriter resource named \"RM1140\" registered on port 250.  The third line is  another  reply  to\nthe same request saying host techpit has laserwriter \"techpit\" registered on port 186.\n\nATP packet formatting is demonstrated by the following example:\njssmag.209.165 > helios.132: atp-req  12266<0-7> 0xae030001\nhelios.132 > jssmag.209.165: atp-resp 12266:0 (512) 0xae040000\nhelios.132 > jssmag.209.165: atp-resp 12266:1 (512) 0xae040000\nhelios.132 > jssmag.209.165: atp-resp 12266:2 (512) 0xae040000\nhelios.132 > jssmag.209.165: atp-resp 12266:3 (512) 0xae040000\nhelios.132 > jssmag.209.165: atp-resp 12266:4 (512) 0xae040000\nhelios.132 > jssmag.209.165: atp-resp 12266:5 (512) 0xae040000\nhelios.132 > jssmag.209.165: atp-resp 12266:6 (512) 0xae040000\nhelios.132 > jssmag.209.165: atp-resp*12266:7 (512) 0xae040000\njssmag.209.165 > helios.132: atp-req  12266<3,5> 0xae030001\nhelios.132 > jssmag.209.165: atp-resp 12266:3 (512) 0xae040000\nhelios.132 > jssmag.209.165: atp-resp 12266:5 (512) 0xae040000\njssmag.209.165 > helios.132: atp-rel  12266<0-7> 0xae030001\njssmag.209.133 > helios.132: atp-req* 12267<0-7> 0xae030002\nJssmag.209 initiates transaction id 12266 with host helios by requesting up to 8 packets (the\n`<0-7>').  The hex number at the end of the line is the value of the `userdata' field in  the\nrequest.\n\nHelios responds with 8 512-byte packets.  The `:digit' following the transaction id gives the\npacket sequence number in the transaction and the number in parens is the amount of  data  in\nthe  packet,  excluding  the  ATP header.  The `*' on packet 7 indicates that the EOM bit was\nset.\n\nJssmag.209 then requests that packets 3 & 5 be retransmitted.  Helios resends them then  jss‐\nmag.209  releases  the transaction.  Finally, jssmag.209 initiates the next request.  The `*'\non the request indicates that XO (`exactly once') was not set.\n\n"
                }
            ]
        },
        "SEE ALSO": {
            "content": "stty(1), pcap(3PCAP), bpf(4), nit(4P), pcap-savefile(5), pcap-filter(7), pcap-tstamp(7)\n\nhttps://www.iana.org/assignments/media-types/application/vnd.tcpdump.pcap\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "The original authors are:\n\nVan Jacobson, Craig Leres and Steven McCanne, all of the Lawrence Berkeley  National  Labora‐\ntory, University of California, Berkeley, CA.\n\nIt is currently being maintained by tcpdump.org.\n\nThe current version is available via HTTPS:\n\nhttps://www.tcpdump.org/\n\nThe original distribution is available via anonymous ftp:\n\nftp://ftp.ee.lbl.gov/old/tcpdump.tar.Z\n\nIPv6/IPsec  support is added by WIDE/KAME project.  This program uses OpenSSL/LibreSSL, under\nspecific configurations.\n",
            "subsections": []
        },
        "BUGS": {
            "content": "To report a security issue please send an e-mail to security@tcpdump.org.\n\nTo report bugs and other problems, contribute patches, request  a  feature,  provide  generic\nfeedback etc. please see the file CONTRIBUTING in the tcpdump source tree root.\n\nNIT doesn't let you watch your own outbound traffic, BPF will.  We recommend that you use the\nlatter.\n\nOn Linux systems with 2.0[.x] kernels:\n\npackets on the loopback device will be seen twice;\n\npacket filtering cannot be done in the kernel, so that all packets must be copied from\nthe kernel in order to be filtered in user mode;\n\nall  of  a packet, not just the part that's within the snapshot length, will be copied\nfrom the kernel (the 2.0[.x] packet capture mechanism, if asked to copy only part of a\npacket  to  userspace, will not report the true length of the packet; this would cause\nmost IP packets to get an error from tcpdump);\n\ncapturing on some PPP devices won't work correctly.\n\nWe recommend that you upgrade to a 2.2 or later kernel.\n\nSome attempt should be made to reassemble IP fragments or, at  least  to  compute  the  right\nlength for the higher level protocol.\n\nName server inverse queries are not dumped correctly: the (empty) question section is printed\nrather than real query in the answer section.  Some believe that inverse  queries  are  them‐\nselves a bug and prefer to fix the program generating them rather than tcpdump.\n\nA  packet trace that crosses a daylight savings time change will give skewed time stamps (the\ntime change is ignored).\n\nFilter expressions on fields other than those in Token Ring headers will not correctly handle\nsource-routed Token Ring packets.\n\nFilter  expressions  on  fields  other than those in 802.11 headers will not correctly handle\n802.11 data packets with both To DS and From DS set.\n\nip6 proto should chase header chain, but at this moment it does not.  ip6 protochain is  sup‐\nplied for this behavior.\n\nArithmetic  expression  against  transport  layer headers, like tcp[0], does not work against\nIPv6 packets.  It only looks at IPv4 packets.\n\n\n\n21 December 2020                                TCPDUMP(8)",
            "subsections": []
        }
    },
    "summary": "tcpdump - dump traffic on a network",
    "flags": [
        {
            "flag": "-A",
            "long": null,
            "arg": null,
            "description": "pages."
        },
        {
            "flag": "-b",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-B",
            "long": null,
            "arg": null,
            "description": "--buffer-size=buffersize Set the operating system capture buffer size to buffersize, in units of KiB (1024 bytes)."
        },
        {
            "flag": "-c",
            "long": null,
            "arg": null,
            "description": "Exit after receiving count packets."
        },
        {
            "flag": "",
            "long": "--count",
            "arg": null,
            "description": "Print only on stderr the packet count when reading capture file(s) instead of pars‐ ing/printing the packets. If a filter is specified on the command line, tcpdump counts only packets that were matched by the filter expression."
        },
        {
            "flag": "-C",
            "long": null,
            "arg": null,
            "description": "Before writing a raw packet to a savefile, check whether the file is currently larger than filesize and, if so, close the current savefile and open a new one. Savefiles after the first savefile will have the name specified with the -w flag, with a number after it, starting at 1 and continuing upward. The units of filesize are millions of bytes (1,000,000 bytes, not 1,048,576 bytes). Note that when used with -Z option (enabled by default), privileges are dropped before opening first savefile."
        },
        {
            "flag": "-d",
            "long": null,
            "arg": null,
            "description": "stop. Please mind that although code compilation is always DLT-specific, typically it is im‐ possible (and unnecessary) to specify which DLT to use for the dump because tcpdump uses either the DLT of the input pcap file specified with -r, or the default DLT of the network interface specified with -i, or the particular DLT of the network inter‐ face specified with -y and -i respectively. In these cases the dump shows the same ex‐ act code that would filter the input file or the network interface without -d. However, when neither -r nor -i is specified, specifying -d prevents tcpdump from guessing a suitable network interface (see -i). In this case the DLT defaults to EN10MB and can be set to another valid value manually with -y."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-D",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": "--list-interfaces",
            "arg": null,
            "description": "Print the list of the network interfaces available on the system and on which tcpdump can capture packets. For each network interface, a number and an interface name, pos‐ sibly followed by a text description of the interface, are printed. The interface name or the number can be supplied to the -i flag to specify an interface on which to capture. This can be useful on systems that don't have a command to list them (e.g., Windows systems, or UNIX systems lacking ifconfig -a); the number can be useful on Windows 2000 and later systems, where the interface name is a somewhat complex string. The -D flag will not be supported if tcpdump was built with an older version of libp‐ cap that lacks the pcapfindalldevs(3PCAP) function."
        },
        {
            "flag": "-e",
            "long": null,
            "arg": null,
            "description": "print MAC layer addresses for protocols such as Ethernet and IEEE 802.11."
        },
        {
            "flag": "-E",
            "long": null,
            "arg": null,
            "description": "and contain Security Parameter Index value spi. This combination may be repeated with comma or newline separation. Note that setting the secret for IPv4 ESP packets is supported at this time. Algorithms may be des-cbc, 3des-cbc, blowfish-cbc, rc3-cbc, cast128-cbc, or none. The default is des-cbc. The ability to decrypt packets is only present if tcpdump was compiled with cryptography enabled. secret is the ASCII text for ESP secret key. If preceded by 0x, then a hex value will be read. The option assumes RFC2406 ESP, not RFC1827 ESP. The option is only for debugging purposes, and the use of this option with a true `secret' key is discouraged. By pre‐ senting IPsec secret key onto command line you make it visible to others, via ps(1) and other occasions. In addition to the above syntax, the syntax file name may be used to have tcpdump read the provided file in. The file is opened upon receiving the first ESP packet, so any special permissions that tcpdump may have been given should already have been given up."
        },
        {
            "flag": "-f",
            "long": null,
            "arg": null,
            "description": "intended to get around serious brain damage in Sun's NIS server — usually it hangs forever translating non-local internet numbers). The test for `foreign' IPv4 addresses is done using the IPv4 address and netmask of the interface on which capture is being done. If that address or netmask are not available, available, either because the interface on which capture is being done has no address or netmask or because the capture is being done on the Linux \"any\" inter‐ face, which can capture on more than one interface, this option will not work cor‐ rectly."
        },
        {
            "flag": "-F",
            "long": null,
            "arg": null,
            "description": "Use file as input for the filter expression. An additional expression given on the command line is ignored."
        },
        {
            "flag": "-G",
            "long": null,
            "arg": null,
            "description": "If specified, rotates the dump file specified with the -w option every rotateseconds seconds. Savefiles will have the name specified by -w which should include a time format as defined by strftime(3). If no time format is specified, each new file will overwrite the previous. Whenever a generated filename is not unique, tcpdump will overwrite the pre-existing data; providing a time specification that is coarser than the capture period is therefore not advised. If used in conjunction with the -C option, filenames will take the form of `file<count>'."
        },
        {
            "flag": "-h",
            "long": null,
            "arg": null,
            "description": "--help Print the tcpdump and libpcap version strings, print a usage message, and exit."
        },
        {
            "flag": "",
            "long": "--version",
            "arg": null,
            "description": "Print the tcpdump and libpcap version strings and exit."
        },
        {
            "flag": "-H",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-i",
            "long": null,
            "arg": null,
            "description": "--interface=interface Listen, report the list of link-layer types, report the list of time stamp types, or report the results of compiling a filter expression on interface. If unspecified and if the -d flag is not given, tcpdump searches the system interface list for the lowest numbered, configured up interface (excluding loopback), which may turn out to be, for example, ``eth0''. On Linux systems with 2.2 or later kernels, an interface argument of ``any'' can be used to capture packets from all interfaces. Note that captures on the ``any'' device will not be done in promiscuous mode. If the -D flag is supported, an interface number as printed by that flag can be used as the interface argument, if no interface on the system has that number as a name."
        },
        {
            "flag": "-I",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": "--monitor-mode",
            "arg": null,
            "description": "Put the interface in \"monitor mode\"; this is supported only on IEEE 802.11 Wi-Fi in‐ terfaces, and supported only on some operating systems. Note that in monitor mode the adapter might disassociate from the network with which it's associated, so that you will not be able to use any wireless networks with that adapter. This could prevent accessing files on a network server, or resolving host names or network addresses, if you are capturing in monitor mode and are not connected to another network with another adapter. This flag will affect the output of the -L flag. If -I isn't specified, only those link-layer types available when not in monitor mode will be shown; if -I is specified, only those link-layer types available when in monitor mode will be shown."
        },
        {
            "flag": "",
            "long": "--immediate-mode",
            "arg": null,
            "description": "Capture in \"immediate mode\". In this mode, packets are delivered to tcpdump as soon as they arrive, rather than being buffered for efficiency. This is the default when printing packets rather than saving packets to a ``savefile'' if the packets are being printed to a terminal rather than to a file or pipe."
        },
        {
            "flag": "-j",
            "long": null,
            "arg": null,
            "description": "--time-stamp-type=tstamptype Set the time stamp type for the capture to tstamptype. The names to use for the time stamp types are given in pcap-tstamp(7); not all the types listed there will necessar‐ ily be valid for any given interface."
        },
        {
            "flag": "-J",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": "--list-time-stamp-types",
            "arg": null,
            "description": "List the supported time stamp types for the interface and exit. If the time stamp type cannot be set for the interface, no time stamp types are listed. --time-stamp-precision=tstampprecision When capturing, set the time stamp precision for the capture to tstampprecision. Note that availability of high precision time stamps (nanoseconds) and their actual accuracy is platform and hardware dependent. Also note that when writing captures made with nanosecond accuracy to a savefile, the time stamps are written with nanosec‐ ond resolution, and the file is written with a different magic number, to indicate that the time stamps are in seconds and nanoseconds; not all programs that read pcap savefiles will be able to read those captures. When reading a savefile, convert time stamps to the precision specified by time‐ stampprecision, and display them with that resolution. If the precision specified is less than the precision of time stamps in the file, the conversion will lose preci‐ sion. The supported values for timestampprecision are micro for microsecond resolution and nano for nanosecond resolution. The default is microsecond resolution."
        },
        {
            "flag": "",
            "long": "--micro",
            "arg": null,
            "description": "--nano Shorthands for --time-stamp-precision=micro or --time-stamp-precision=nano, adjusting the time stamp precision accordingly. When reading packets from a savefile, using --micro truncates time stamps if the savefile was created with nanosecond precision. In contrast, a savefile created with microsecond precision will have trailing zeroes added to the time stamp when --nano is used."
        },
        {
            "flag": "-K",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": "--dont-verify-checksums",
            "arg": null,
            "description": "Don't attempt to verify IP, TCP, or UDP checksums. This is useful for interfaces that perform some or all of those checksum calculation in hardware; otherwise, all outgoing TCP checksums will be flagged as bad."
        },
        {
            "flag": "-l",
            "long": null,
            "arg": null,
            "description": "E.g., tcpdump -l | tee dat or tcpdump -l > dat & tail -f dat Note that on Windows,``line buffered'' means ``unbuffered'', so that WinDump will write each character individually if -l is specified. -U is similar to -l in its behavior, but it will cause output to be ``packet- buffered'', so that the output is written to stdout at the end of each packet rather than at the end of each line; this is buffered on all platforms, including Windows."
        },
        {
            "flag": "-L",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": "--list-data-link-types",
            "arg": null,
            "description": "List the known data link types for the interface, in the specified mode, and exit. The list of known data link types may be dependent on the specified mode; for example, on some platforms, a Wi-Fi interface might support one set of data link types when not in monitor mode (for example, it might support only fake Ethernet headers, or might support 802.11 headers but not support 802.11 headers with radio information) and an‐ other set of data link types when in monitor mode (for example, it might support 802.11 headers, or 802.11 headers with radio information, only in monitor mode)."
        },
        {
            "flag": "-m",
            "long": null,
            "arg": null,
            "description": "Load SMI MIB module definitions from file module. This option can be used several times to load several MIB modules into tcpdump."
        },
        {
            "flag": "-M",
            "long": null,
            "arg": null,
            "description": "Use secret as a shared secret for validating the digests found in TCP segments with the TCP-MD5 option (RFC 2385), if present."
        },
        {
            "flag": "-n",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-N",
            "long": null,
            "arg": null,
            "description": "tcpdump will print ``nic'' instead of ``nic.ddn.mil''. -#"
        },
        {
            "flag": "",
            "long": "--number",
            "arg": null,
            "description": "Print an optional packet number at the beginning of the line."
        },
        {
            "flag": "-O",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": "--no-optimize",
            "arg": null,
            "description": "Do not run the packet-matching code optimizer. This is useful only if you suspect a bug in the optimizer."
        },
        {
            "flag": "-p",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": "--no-promiscuous-mode",
            "arg": null,
            "description": "Don't put the interface into promiscuous mode. Note that the interface might be in promiscuous mode for some other reason; hence, `-p' cannot be used as an abbreviation for `ether host {local-hw-addr} or ether broadcast'."
        },
        {
            "flag": "",
            "long": "--print",
            "arg": null,
            "description": "Print parsed packet output, even if the raw packets are being saved to a file with the -w flag."
        },
        {
            "flag": "-Q",
            "long": null,
            "arg": null,
            "description": "--direction=direction Choose send/receive direction direction for which packets should be captured. Possible values are `in', `out' and `inout'. Not available on all platforms."
        },
        {
            "flag": "-q",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-r",
            "long": null,
            "arg": null,
            "description": "Read packets from file (which was created with the -w option or by other tools that write pcap or pcapng files). Standard input is used if file is ``-''."
        },
        {
            "flag": "-S",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": "--absolute-tcp-sequence-numbers",
            "arg": null,
            "description": "Print absolute, rather than relative, TCP sequence numbers."
        },
        {
            "flag": "-s",
            "long": null,
            "arg": null,
            "description": "--snapshot-length=snaplen Snarf snaplen bytes of data from each packet rather than the default of 262144 bytes. Packets truncated because of a limited snapshot are indicated in the output with ``[|proto]'', where proto is the name of the protocol level at which the truncation has occurred. Note that taking larger snapshots both increases the amount of time it takes to process packets and, effectively, decreases the amount of packet buffering. This may cause packets to be lost. Note also that taking smaller snapshots will discard data from protocols above the transport layer, which loses information that may be impor‐ tant. NFS and AFS requests and replies, for example, are very large, and much of the detail won't be available if a too-short snapshot length is selected. If you need to reduce the snapshot size below the default, you should limit snaplen to the smallest number that will capture the protocol information you're interested in. Setting snaplen to 0 sets it to the default of 262144, for backwards compatibility with recent older versions of tcpdump."
        },
        {
            "flag": "-T",
            "long": null,
            "arg": null,
            "description": "Force packets selected by \"expression\" to be interpreted the specified type. Cur‐ rently known types are aodv (Ad-hoc On-demand Distance Vector protocol), carp (Common Address Redundancy Protocol), cnfp (Cisco NetFlow protocol), domain (Domain Name Sys‐ tem), lmp (Link Management Protocol), pgm (Pragmatic General Multicast), pgmzmtp1 (ZMTP/1.0 inside PGM/EPGM), ptp (Precision Time Protocol), radius (RADIUS), resp (RE‐ dis Serialization Protocol), rpc (Remote Procedure Call), rtcp (Real-Time Applications control protocol), rtp (Real-Time Applications protocol), snmp (Simple Network Manage‐ ment Protocol), someip (SOME/IP), tftp (Trivial File Transfer Protocol), vat (Visual Audio Tool), vxlan (Virtual eXtensible Local Area Network), wb (distributed White Board) and zmtp1 (ZeroMQ Message Transport Protocol 1.0). Note that the pgm type above affects UDP interpretation only, the native PGM is always recognised as IP protocol 113 regardless. UDP-encapsulated PGM is often called \"EPGM\" or \"PGM/UDP\". Note that the pgmzmtp1 type above affects interpretation of both native PGM and UDP at once. During the native PGM decoding the application data of an ODATA/RDATA packet would be decoded as a ZeroMQ datagram with ZMTP/1.0 frames. During the UDP decoding in addition to that any UDP packet would be treated as an encapsulated PGM packet."
        },
        {
            "flag": "-t",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "a second since that time, on each dump line."
        },
        {
            "flag": "",
            "long": "--time-stamp-pre",
            "arg": null,
            "description": "cision option) between current and previous line on each dump line. The default is microsecond resolution."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "night, preceded by the date, on each dump line."
        },
        {
            "flag": "",
            "long": "--time-stamp-pre",
            "arg": null,
            "description": "cision option) between current and first line on each dump line. The default is mi‐ crosecond resolution."
        },
        {
            "flag": "-u",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-U",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": "--packet-buffered",
            "arg": null,
            "description": "If the -w option is not specified, or if it is specified but the --print flag is also specified, make the printed packet output ``packet-buffered''; i.e., as the descrip‐ tion of the contents of each packet is printed, it will be written to the standard output, rather than, when not writing to a terminal, being written only when the out‐ put buffer fills. If the -w option is specified, make the saved raw packet output ``packet-buffered''; i.e., as each packet is saved, it will be written to the output file, rather than be‐ ing written only when the output buffer fills. The -U flag will not be supported if tcpdump was built with an older version of libp‐ cap that lacks the pcapdumpflush(3PCAP) function."
        },
        {
            "flag": "-v",
            "long": null,
            "arg": null,
            "description": "time to live, identification, total length and options in an IP packet are printed. Also enables additional packet integrity checks such as verifying the IP and ICMP header checksum. When writing to a file with the -w option and at the same time not reading from a file with the -r option, report to stderr, once per second, the number of packets captured. In Solaris, FreeBSD and possibly other operating systems this periodic update cur‐ rently can cause loss of captured packets on their way from the kernel to tcpdump."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "packets, and SMB packets are fully decoded."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "With -X Telnet options are printed in hex as well."
        },
        {
            "flag": "-V",
            "long": null,
            "arg": null,
            "description": "Read a list of filenames from file. Standard input is used if file is ``-''."
        },
        {
            "flag": "-w",
            "long": null,
            "arg": null,
            "description": "Write the raw packets to file rather than parsing and printing them out. They can later be printed with the -r option. Standard output is used if file is ``-''. This output will be buffered if written to a file or pipe, so a program reading from the file or pipe may not see packets for an arbitrary amount of time after they are received. Use the -U flag to cause packets to be written as soon as they are re‐ ceived. The MIME type application/vnd.tcpdump.pcap has been registered with IANA for pcap files. The filename extension .pcap appears to be the most commonly used along with .cap and .dmp. Tcpdump itself doesn't check the extension when reading capture files and doesn't add an extension when writing them (it uses magic numbers in the file header instead). However, many operating systems and applications will use the exten‐ sion if it is present and adding one (e.g. .pcap) is recommended. See pcap-savefile(5) for a description of the file format."
        },
        {
            "flag": "-W",
            "long": null,
            "arg": null,
            "description": "Used in conjunction with the -C option, this will limit the number of files created to the specified number, and begin overwriting files from the beginning, thus creating a 'rotating' buffer. In addition, it will name the files with enough leading 0s to sup‐ port the maximum number of files, allowing them to sort correctly. Used in conjunction with the -G option, this will limit the number of rotated dump files that get created, exiting with status 0 when reaching the limit. If used in conjunction with both -C and -G, the -W option will currently be ignored, and will only affect the file name."
        },
        {
            "flag": "-x",
            "long": null,
            "arg": null,
            "description": "the data of each packet (minus its link level header) in hex. The smaller of the en‐ tire packet or snaplen bytes will be printed. Note that this is the entire link-layer packet, so for link layers that pad (e.g. Ethernet), the padding bytes will also be printed when the higher layer packet is shorter than the required padding. In the current implementation this flag may have the same effect as -xx if the packet is truncated."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "the data of each packet, including its link level header, in hex."
        },
        {
            "flag": "-X",
            "long": null,
            "arg": null,
            "description": "the data of each packet (minus its link level header) in hex and ASCII. This is very handy for analysing new protocols. In the current implementation this flag may have the same effect as -XX if the packet is truncated."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "the data of each packet, including its link level header, in hex and ASCII."
        },
        {
            "flag": "-y",
            "long": null,
            "arg": null,
            "description": "--linktype=datalinktype Set the data link type to use while capturing packets (see -L) or just compiling and dumping packet-matching code (see -d) to datalinktype."
        },
        {
            "flag": "-z",
            "long": null,
            "arg": null,
            "description": "Used in conjunction with the -C or -G options, this will make tcpdump run \" postro‐ tate-command file \" where file is the savefile being closed after each rotation. For example, specifying -z gzip or -z bzip2 will compress each savefile using gzip or bzip2. Note that tcpdump will run the command in parallel to the capture, using the lowest priority so that this doesn't disturb the capture process. And in case you would like to use a command that itself takes flags or different argu‐ ments, you can always write a shell script that will take the savefile name as the only argument, make the flags & arguments arrangements and execute the command that you want."
        },
        {
            "flag": "-Z",
            "long": null,
            "arg": null,
            "description": "--relinquish-privileges=user If tcpdump is running as root, after opening the capture device or input savefile, change the user ID to user and the group ID to the primary group of user. This behavior is enabled by default (-Z tcpdump), and can be disabled by -Z root. expression selects which packets will be dumped. If no expression is given, all packets on the net will be dumped. Otherwise, only packets for which expression is `true' will be dumped. For the expression syntax, see pcap-filter(7). The expression argument can be passed to tcpdump as either a single Shell argument, or as multiple Shell arguments, whichever is more convenient. Generally, if the expres‐ sion contains Shell metacharacters, such as backslashes used to escape protocol names, it is easier to pass it as a single, quoted argument rather than to escape the Shell metacharacters. Multiple arguments are concatenated with spaces before being parsed."
        }
    ],
    "examples": [
        "To print all packets arriving at or departing from sundown:",
        "tcpdump host sundown",
        "To print traffic between helios and either hot or ace:",
        "tcpdump host helios and \\( hot or ace \\)",
        "To print all IP packets between ace and any host except helios:",
        "tcpdump ip host ace and not helios",
        "To print all traffic between local hosts and hosts at Berkeley:",
        "tcpdump net ucb-ether",
        "To print all ftp traffic through internet gateway snup: (note that the expression  is  quoted",
        "to prevent the shell from (mis-)interpreting the parentheses):",
        "tcpdump 'gateway snup and (port ftp or ftp-data)'",
        "To  print  traffic  neither  sourced from nor destined for local hosts (if you gateway to one",
        "other net, this stuff should never make it onto your local net).",
        "tcpdump ip and not net localnet",
        "To print the start and end packets (the SYN and FIN packets) of each  TCP  conversation  that",
        "involves a non-local host.",
        "tcpdump 'tcp[tcpflags] & (tcp-syn|tcp-fin) != 0 and not src and dst net localnet'",
        "To  print the TCP packets with flags RST and ACK both set.  (i.e. select only the RST and ACK",
        "flags in the flags field, and if the result is \"RST and ACK both set\", match)",
        "tcpdump 'tcp[tcpflags] & (tcp-rst|tcp-ack) == (tcp-rst|tcp-ack)'",
        "To print all IPv4 HTTP packets to and from port 80, i.e.  print  only  packets  that  contain",
        "data,  not, for example, SYN and FIN packets and ACK-only packets.  (IPv6 is left as an exer‐",
        "cise for the reader.)",
        "tcpdump 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'",
        "To print IP packets longer than 576 bytes sent through gateway snup:",
        "tcpdump 'gateway snup and ip[2:2] > 576'",
        "To print IP broadcast or multicast packets that were not sent via Ethernet broadcast or  mul‐",
        "ticast:",
        "tcpdump 'ether[0] & 1 = 0 and ip[16] >= 224'",
        "To print all ICMP packets that are not echo requests/replies (i.e., not ping packets):",
        "tcpdump 'icmp[icmptype] != icmp-echo and icmp[icmptype] != icmp-echoreply'"
    ],
    "see_also": [
        {
            "name": "stty",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/stty/1/json"
        },
        {
            "name": "pcap",
            "section": "3PCAP",
            "url": "https://www.chedong.com/phpMan.php/man/pcap/3PCAP/json"
        },
        {
            "name": "bpf",
            "section": "4",
            "url": "https://www.chedong.com/phpMan.php/man/bpf/4/json"
        },
        {
            "name": "nit",
            "section": "4P",
            "url": "https://www.chedong.com/phpMan.php/man/nit/4P/json"
        },
        {
            "name": "pcap-savefile",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/pcap-savefile/5/json"
        },
        {
            "name": "pcap-filter",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/pcap-filter/7/json"
        },
        {
            "name": "pcap-tstamp",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/pcap-tstamp/7/json"
        }
    ]
}