1 .\" Copyright (c) 1988-1990 The Regents of the University of California.
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that: (1) source code distributions
6 .\" retain the above copyright notice and this paragraph in its entirety, (2)
7 .\" distributions including binary code include the above copyright notice and
8 .\" this paragraph in its entirety in the documentation or other materials
9 .\" provided with the distribution, and (3) all advertising materials mentioning
10 .\" features or use of this software display the following acknowledgement:
11 .\" ``This product includes software developed by the University of California,
12 .\" Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
13 .\" the University nor the names of its contributors may be used to endorse
14 .\" or promote products derived from this software without specific prior
15 .\" written permission.
16 .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
17 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
18 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 .\" $FreeBSD: src/usr.sbin/tcpdump/tcpslice/tcpslice.1,v 1.7.2.8 2003/03/11 22:31:33 trhodes Exp $
27 .Nd extract pieces of and/or glue together tcpdump files
32 .Op Ar start-time Op end-time
37 utility extracts portions of packet-trace files generated using
41 It can also be used to glue together several such files, as discussed
44 The basic operation of
48 all packets from its input file(s) whose timestamps fall
49 within a given range. The starting and ending times of the range
50 may be specified on the command line. All ranges are inclusive.
51 The starting time defaults
52 to the time of the first packet in the first input file; we call
55 The ending time defaults to ten years after the starting time.
63 (assuming the file does not include more than
64 ten years' worth of data).
66 There are a number of ways to specify times. The first is using
67 Unix timestamps of the form
69 (this is the format specified by
75 specifies 38 seconds and 765,400 microseconds
76 after 8:51PM PDT, Sept. 25, 1990.
78 All examples in this manual are given
79 for PDT times, but when displaying times and interpreting times symbolically
82 uses the local timezone, regardless of the timezone in which the
84 file was generated. The daylight-savings setting used is that which is
85 appropriate for the local timezone at the date in question. For example,
86 times associated with summer months will usually include daylight-savings
87 effects, and those with winter months will not.
89 Times may also be specified relative
92 (when specifying a starting time)
93 or the starting time (when specifying an ending time)
94 by preceding a numeric value in seconds with a `+'.
95 For example, a starting time of
97 indicates 200 seconds after the
101 indicate from 200 seconds after the
103 through 500 seconds after the
106 Times may also be specified in terms of years (y), months (m), days (d),
107 hours (h), minutes (m), seconds (s), and microseconds(u). For example,
108 the Unix timestamp 654321098.7654 discussed above could also be expressed
110 .Em 90y9m25d20h51m38s765400u .
112 When specifying times using this style, fields that are omitted default
113 as follows. If the omitted field is a unit
115 than that of the first specified field, then its value defaults to
116 the corresponding value taken from either
118 (if the starting time is being specified) or the starting time
119 (if the ending time is being specified).
120 If the omitted field is a unit
122 than that of the first specified field, then it defaults to zero.
123 For example, suppose that the input file has a
125 of the Unix timestamp mentioned above, i.e., 38 seconds and 765,400 microseconds
126 after 8:51PM PDT, Sept. 25, 1990. To specify 9:36PM PDT (exactly) on the
127 same date we could use
129 To specify a range from 9:36PM PDT through 1:54AM PDT the next day we
131 .Em 21h36m 26d1h54m .
133 Relative times can also be specified when using the
135 format. Omitted fields then default to 0 if the unit of the field is
137 than that of the first specified field, and to the corresponding value
138 taken from either the
140 or the starting time if the omitted field's unit is
142 than that of the first specified field. Given a
144 of the Unix timestamp mentioned above,
146 specifies a range from 10:00PM PDT on that date through 11:10PM PDT, and
148 specifies a range from 38.7654 seconds after 9:51PM PDT through 38.7654
149 seconds after 11:01PM PDT. The first hour of the file could be extracted
155 format there is an ambiguity between using
157 for `month' or for `minute'. The ambiguity is resolved as follows: if an
159 field is followed by a
161 field then it is interpreted as specifying months; otherwise it
164 If more than one input file is specified then
166 first copies packets lying in the given range from the first file; it
167 then increases the starting time of the range to lie just beyond the
168 timestamp of the last packet in the first file, repeats the process
169 with the second file, and so on. Thus files with interleaved packets
172 merged. For a given file, only packets that are newer than any in the
173 preceding files will be considered. This mechanism avoids any possibility
174 of a packet occurring more than once in the output.
183 reports the timestamps of the first and last packets in each input file
184 and exits. Only one of these three options may be specified.
186 The following options are available:
187 .Bl -tag -width indent
189 Dump the start and end times specified by the given range and
190 exit. This option is useful for checking that the given range actually
191 specifies the times you think it does. If one of
196 has been specified then the times are dumped in the corresponding
197 format; otherwise, raw format
201 Dump the timestamps of the first and last packets in each input file
202 as raw timestamps (i.e., in the form
203 .Em sssssssss.uuuuuu ) .
207 except the timestamps are dumped in human-readable format, similar
213 except the timestamps are dumped in
217 format discussed above.
227 .An Vern Paxson Aq vern@ee.lbl.gov ,
228 of Lawrence Berkeley Laboratory, University of California, Berkeley, CA.
230 An input filename that beings with a digit or a `+' can be confused
231 with a start/end time. Such filenames can be specified with a
232 leading `./'; for example, specify the file `04Jul76.trace' as
237 utility cannot read its input from
239 since it uses random-access
240 to rummage through its input files.
244 utility refuses to write to its output if it is a terminal
247 This is not a bug but a feature,
248 to prevent it from spraying binary data to the user's terminal.
249 Note that this means you must either redirect
257 utility will not work properly on
259 files spanning more than one year;
260 with files containing portions of packets whose original length was
261 more than 65,535 bytes; nor with files containing fewer than three packets.
263 the error message: `couldn't find final packet in file'. These problems
264 are due to the interpolation scheme used by
266 to greatly speed up its processing when dealing with large trace files.
269 can efficiently extract slices from the middle of trace files of any
270 size, and can also work with truncated trace files (i.e., the final packet
271 in the file is only partially present, typically due to
273 being ungracefully killed).