1DUMPCAP(1) The Wireshark Network Analyzer DUMPCAP(1)
2
3
4
6 dumpcap - Dump network traffic
7
9 dumpcap [ -a|--autostop <capture autostop condition> ] ...
10 [ -b|--ring-buffer <capture ring buffer option>] ...
11 [ -B|--buffer-size <capture buffer size> ]
12 [ -c <capture packet count> ] [ -C <byte limit> ] [ -d ]
13 [ -D|--list-interfaces ] [ -f <capture filter> ] [ -g ] [ -h|--help ]
14 [ -i|--interface <capture interface>|rpcap://<host>:<port>/<capture interface>|TCP@<host>:<port>|- ]
15 [ -I|--monitor-mode ]
16 [ -k <freq>,[<type>],[<center_freq1>],[<center_freq2>]
17 [ -L|--list-data-link-types ] [ -M ] [ -n ] [ -N <packet limit> ]
18 [ -p|--no-promiscuous-mode ] [ -P ] [ -q ]
19 [ -s|--snapshot-length <capture snaplen> ] [ -S ] [ -t ]
20 [ -v|--version ] [ -w <outfile> ] [ -y|--linktype <capture link type> ]
21 [ --capture-comment <comment> ] [ --list-time-stamp-types ]
22 [ --time-stamp-type <type> ]
23
25 Dumpcap is a network traffic dump tool. It lets you capture packet
26 data from a live network and write the packets to a file. Dumpcap's
27 default capture file format is pcapng format. When the -P option is
28 specified, the output file is written in the pcap format.
29
30 Without any options set it will use the libpcap, Npcap, or WinPcap
31 library to capture traffic from the first available network interface
32 and writes the received raw packet data, along with the packets' time
33 stamps into a pcap file.
34
35 If the -w option is not specified, Dumpcap writes to a newly created
36 pcap file with a randomly chosen name. If the -w option is specified,
37 Dumpcap writes to the file specified by that option.
38
39 Packet capturing is performed with the pcap library. The capture
40 filter syntax follows the rules of the pcap library.
41
43 -a|--autostop <capture autostop condition>
44 Specify a criterion that specifies when Dumpcap is to stop writing
45 to a capture file. The criterion is of the form test:value, where
46 test is one of:
47
48 duration:value Stop writing to a capture file after value seconds
49 have elapsed. Floating point values (e.g. 0.5) are allowed.
50
51 files:value Stop writing to capture files after value number of
52 files were written.
53
54 filesize:value Stop writing to a capture file after it reaches a
55 size of value kB. If this option is used together with the -b
56 option, dumpcap will stop writing to the current capture file and
57 switch to the next one if filesize is reached. Note that the
58 filesize is limited to a maximum value of 2 GiB.
59
60 packets:value Stop writing to a capture file after value packets
61 have been written. Same as -c <capture packet count>.
62
63 -b|--ring-buffer <capture ring buffer option>
64 Cause Dumpcap to run in "multiple files" mode. In "multiple files"
65 mode, Dumpcap will write to several capture files. When the first
66 capture file fills up, Dumpcap will switch writing to the next file
67 and so on.
68
69 The created filenames are based on the filename given with the -w
70 option, the number of the file and on the creation date and time,
71 e.g. outfile_00001_20210714120117.pcap,
72 outfile_00002_20210714120523.pcap, ...
73
74 With the files option it's also possible to form a "ring buffer".
75 This will fill up new files until the number of files specified, at
76 which point Dumpcap will discard the data in the first file and
77 start writing to that file and so on. If the files option is not
78 set, new files filled up until one of the capture stop conditions
79 match (or until the disk is full).
80
81 The criterion is of the form key:value, where key is one of:
82
83 duration:value switch to the next file after value seconds have
84 elapsed, even if the current file is not completely filled up.
85 Floating point values (e.g. 0.5) are allowed.
86
87 files:value begin again with the first file after value number of
88 files were written (form a ring buffer). This value must be less
89 than 100000. Caution should be used when using large numbers of
90 files: some filesystems do not handle many files in a single
91 directory well. The files criterion requires either duration,
92 interval or filesize to be specified to control when to go to the
93 next file. It should be noted that each -b parameter takes exactly
94 one criterion; to specify two criterion, each must be preceded by
95 the -b option.
96
97 filesize:value switch to the next file after it reaches a size of
98 value kB. Note that the filesize is limited to a maximum value of
99 2 GiB.
100
101 interval:value switch to the next file when the time is an exact
102 multiple of value seconds. For example, use 3600 to switch to a
103 new file every hour on the hour.
104
105 packets:value switch to the next file after it contains value
106 packets.
107
108 printname:filename print the name of the most recently written file
109 to filename after the file is closed. filename can be "stdout" or
110 "-" for standard output, or "stderr" for standard error.
111
112 Example: -b filesize:1000 -b files:5 results in a ring buffer of
113 five files of size one megabyte each.
114
115 -B|--buffer-size <capture buffer size>
116 Set capture buffer size (in MiB, default is 2 MiB). This is used
117 by the capture driver to buffer packet data until that data can be
118 written to disk. If you encounter packet drops while capturing,
119 try to increase this size. Note that, while Dumpcap attempts to
120 set the buffer size to 2 MiB by default, and can be told to set it
121 to a larger value, the system or interface on which you're
122 capturing might silently limit the capture buffer size to a lower
123 value or raise it to a higher value.
124
125 This is available on UNIX systems with libpcap 1.0.0 or later and
126 on Windows. It is not available on UNIX systems with earlier
127 versions of libpcap.
128
129 This option can occur multiple times. If used before the first
130 occurrence of the -i option, it sets the default capture buffer
131 size. If used after an -i option, it sets the capture buffer size
132 for the interface specified by the last -i option occurring before
133 this option. If the capture buffer size is not set specifically,
134 the default capture buffer size is used instead.
135
136 -c <capture packet count>
137 Set the maximum number of packets to read when capturing live data.
138 Same as -a packets:<capture packet count>.
139
140 -C <byte limit>
141 Limit the amount of memory in bytes used for storing captured
142 packets in memory while processing it. If used in combination with
143 the -N option, both limits will apply. Setting this limit will
144 enable the usage of the separate thread per interface.
145
146 -d Dump the code generated for the capture filter in a human-readable
147 form, and exit.
148
149 -D|--list-interfaces
150 Print a list of the interfaces on which Dumpcap can capture, and
151 exit. For each network interface, a number and an interface name,
152 possibly followed by a text description of the interface, is
153 printed. The interface name or the number can be supplied to the
154 -i option to specify an interface on which to capture.
155
156 This can be useful on systems that don't have a command to list
157 them (UNIX systems lacking ifconfig -a or Linux systems lacking ip
158 link show). The number can be useful on Windows systems, where the
159 interface name might be a long name or a GUID.
160
161 Note that "can capture" means that Dumpcap was able to open that
162 device to do a live capture. Depending on your system you may need
163 to run dumpcap from an account with special privileges (for
164 example, as root) to be able to capture network traffic. If
165 "dumpcap -D" is not run from such an account, it will not list any
166 interfaces.
167
168 -f <capture filter>
169 Set the capture filter expression.
170
171 The entire filter expression must be specified as a single argument
172 (which means that if it contains spaces, it must be quoted).
173
174 This option can occur multiple times. If used before the first
175 occurrence of the -i option, it sets the default capture filter
176 expression. If used after an -i option, it sets the capture filter
177 expression for the interface specified by the last -i option
178 occurring before this option. If the capture filter expression is
179 not set specifically, the default capture filter expression is used
180 if provided.
181
182 Pre-defined capture filter names, as shown in the GUI menu item
183 Capture->Capture Filters, can be used by prefixing the argument
184 with "predef:". Example: -f "predef:MyPredefinedHostOnlyFilter"
185
186 -g This option causes the output file(s) to be created with group-read
187 permission (meaning that the output file(s) can be read by other
188 members of the calling user's group).
189
190 -h|--help
191 Print the version and options and exits.
192
193 -i|--interface <capture interface>|rpcap://<host>:<port>/<capture
194 interface>|TCP@<host>:<port>|-
195 Set the name of the network interface or pipe to use for live
196 packet capture.
197
198 Network interface names should match one of the names listed in
199 "dumpcap -D" (described above); a number, as reported by "dumpcap
200 -D", can also be used. If you're using UNIX, "netstat -i",
201 "ifconfig -a" or "ip link" might also work to list interface names,
202 although not all versions of UNIX support the -a option to
203 ifconfig.
204
205 If no interface is specified, Dumpcap searches the list of
206 interfaces, choosing the first non-loopback interface if there are
207 any non-loopback interfaces, and choosing the first loopback
208 interface if there are no non-loopback interfaces. If there are no
209 interfaces at all, Dumpcap reports an error and doesn't start the
210 capture.
211
212 Pipe names should be either the name of a FIFO (named pipe) or "-"
213 to read data from the standard input. On Windows systems, pipe
214 names must be of the form "\\pipe\.\pipename". Data read from
215 pipes must be in standard pcapng or pcap format. Pcapng data must
216 have the same endianness as the capturing host.
217
218 This option can occur multiple times. When capturing from multiple
219 interfaces, the capture file will be saved in pcapng format.
220
221 -I|--monitor-mode
222 Put the interface in "monitor mode"; this is supported only on IEEE
223 802.11 Wi-Fi interfaces, and supported only on some operating
224 systems.
225
226 Note that in monitor mode the adapter might disassociate from the
227 network with which it's associated, so that you will not be able to
228 use any wireless networks with that adapter. This could prevent
229 accessing files on a network server, or resolving host names or
230 network addresses, if you are capturing in monitor mode and are not
231 connected to another network with another adapter.
232
233 This option can occur multiple times. If used before the first
234 occurrence of the -i option, it enables the monitor mode for all
235 interfaces. If used after an -i option, it enables the monitor
236 mode for the interface specified by the last -i option occurring
237 before this option.
238
239 -k <freq>,[<type>],[<center_freq1>],[<center_freq2>>
240 Set the channel on the interface; this is supported only on IEEE
241 802.11 Wi-Fi interfaces, and supported only on some operating
242 systems.
243
244 freq is the frequency of the channel. type is the type of the
245 channel, for 802.11n and 802.11ac. The values for type are
246
247 NOHT Used for non-802.11n/non-802.1ac channels
248
249 HT20 20 MHz channel
250
251 HT40- 40 MHz primary channel and a lower secondary channel
252
253 HT40+ 40 MHz primary channel and a higher secondary channel
254
255 HT80 80 MHz channel, with centerfreq1 as its center frequency
256
257 VHT80+80
258 two 80 MHz channels combined, with centerfreq1 and
259 centerfreq2 as the center frequencies of the two channels
260
261 VHT160 160 MHz channel, with centerfreq1 as its center frequency
262
263 -L|--list-data-link-types
264 List the data link types supported by the interface and exit. The
265 reported link types can be used for the -y option.
266
267 -M When used with -D, -L, -S or --list-time-stamp-types print machine-
268 readable output. The machine-readable output is intended to be
269 read by Wireshark and TShark; its format is subject to change from
270 release to release.
271
272 -n Save files as pcapng. This is the default.
273
274 -N <packet limit>
275 Limit the number of packets used for storing captured packets in
276 memory while processing it. If used in combination with the -C
277 option, both limits will apply. Setting this limit will enable the
278 usage of the separate thread per interface.
279
280 -p|--no-promiscuous-mode
281 Don't put the interface into promiscuous mode. Note that the
282 interface might be in promiscuous mode for some other reason;
283 hence, -p cannot be used to ensure that the only traffic that is
284 captured is traffic sent to or from the machine on which Dumpcap is
285 running, broadcast traffic, and multicast traffic to addresses
286 received by that machine.
287
288 This option can occur multiple times. If used before the first
289 occurrence of the -i option, no interface will be put into the
290 promiscuous mode. If used after an -i option, the interface
291 specified by the last -i option occurring before this option will
292 not be put into the promiscuous mode.
293
294 -P Save files as pcap instead of the default pcapng. In situations
295 that require pcapng, such as capturing from multiple interfaces,
296 this option will be overridden.
297
298 -q When capturing packets, don't display the continuous count of
299 packets captured that is normally shown when saving a capture to a
300 file; instead, just display, at the end of the capture, a count of
301 packets captured. On systems that support the SIGINFO signal, such
302 as various BSDs, you can cause the current count to be displayed by
303 typing your "status" character (typically control-T, although it
304 might be set to "disabled" by default on at least some BSDs, so
305 you'd have to explicitly set it to use it).
306
307 -s|--snapshot-length <capture snaplen>
308 Set the default snapshot length to use when capturing live data.
309 No more than snaplen bytes of each network packet will be read into
310 memory, or saved to disk. A value of 0 specifies a snapshot length
311 of 262144, so that the full packet is captured; this is the
312 default.
313
314 This option can occur multiple times. If used before the first
315 occurrence of the -i option, it sets the default snapshot length.
316 If used after an -i option, it sets the snapshot length for the
317 interface specified by the last -i option occurring before this
318 option. If the snapshot length is not set specifically, the default
319 snapshot length is used if provided.
320
321 -S Print statistics for each interface once every second.
322
323 -t Use a separate thread per interface.
324
325 -v|--version
326 Print the version and exit.
327
328 -w <outfile>
329 Write raw packet data to outfile. Use "-" for stdout.
330
331 -y|--linktype <capture link type>
332 Set the data link type to use while capturing packets. The values
333 reported by -L are the values that can be used.
334
335 This option can occur multiple times. If used before the first
336 occurrence of the -i option, it sets the default capture link type.
337 If used after an -i option, it sets the capture link type for the
338 interface specified by the last -i option occurring before this
339 option. If the capture link type is not set specifically, the
340 default capture link type is used if provided.
341
342 --capture-comment <comment>
343 Add a capture comment to the output file.
344
345 This option is only available if we output the captured packets to
346 a single file in pcapng format. Only one capture comment may be set
347 per output file.
348
349 --list-time-stamp-types
350 List time stamp types supported for the interface. If no time stamp
351 type can be set, no time stamp types are listed.
352
353 --time-stamp-type <type>
354 Change the interface's timestamp method.
355
357 See the manual page of pcap-filter(7) or, if that doesn't exist,
358 tcpdump(8), or, if that doesn't exist,
359 <https://gitlab.com/wireshark/wireshark/-/wikis/CaptureFilters>.
360
362 wireshark(1), tshark(1), editcap(1), mergecap(1), capinfos(1), pcap(3),
363 pcap-filter(7) or tcpdump(8)
364
366 Dumpcap is part of the Wireshark distribution. The latest version of
367 Wireshark can be found at <https://www.wireshark.org>.
368
369 HTML versions of the Wireshark project man pages are available at:
370 <https://www.wireshark.org/docs/man-pages>.
371
373 Dumpcap is derived from the Wireshark capturing engine code; see the
374 list of authors in the Wireshark man page for a list of authors of that
375 code.
376
377
378
3793.4.5 2021-05-27 DUMPCAP(1)