1 .\" Copyright (c) 1990, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" This code is derived from software contributed to Berkeley by
5 .\" Keith Muller of the University of California, San Diego.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
15 .\" 3. All advertising materials mentioning features or use of this software
16 .\" must display the following acknowledgement:
17 .\" This product includes software developed by the University of
18 .\" California, Berkeley and its contributors.
19 .\" 4. Neither the name of the University nor the names of its contributors
20 .\" may be used to endorse or promote products derived from this software
21 .\" without specific prior written permission.
23 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 .\" @(#)dd.1 8.2 (Berkeley) 1/13/94
36 .\" $FreeBSD: src/bin/dd/dd.1,v 1.15.2.5 2003/01/24 02:17:12 keramida Exp $
37 .\" $DragonFly: src/bin/dd/dd.1,v 1.2 2003/06/17 04:22:49 dillon Exp $
44 .Nd convert and copy a file
51 utility copies the standard input to the standard output.
52 Input data is read and written in 512-byte blocks.
53 If input reads are short, input from multiple reads are aggregated
54 to form the output block.
57 displays the number of complete and partial input and output blocks
58 and truncated input records to the standard error output.
60 The following operands are available:
61 .Bl -tag -width ".Cm of Ns = Ns Ar file"
62 .It Cm bs Ns = Ns Ar n
63 Set both input and output block size to
65 bytes, superseding the
70 If no conversion values other than
75 are specified, then each input block is copied to the output as a
76 single block without any aggregation of short blocks.
77 .It Cm cbs Ns = Ns Ar n
78 Set the conversion record size to
81 The conversion record size is required by the record oriented conversion
83 .It Cm count Ns = Ns Ar n
87 .It Cm files Ns = Ns Ar n
90 input files before terminating.
91 This operand is only applicable when the input device is a tape.
92 .It Cm ibs Ns = Ns Ar n
93 Set the input block size to
95 bytes instead of the default 512.
96 .It Cm if Ns = Ns Ar file
99 instead of the standard input.
100 .It Cm iseek Ns = Ns Ar n
101 Seek on the input file
104 This is synonymous with
105 .Cm skip Ns = Ns Ar n .
106 .It Cm obs Ns = Ns Ar n
107 Set the output block size to
109 bytes instead of the default 512.
110 .It Cm of Ns = Ns Ar file
113 instead of the standard output.
114 Any regular output file is truncated unless the
116 conversion value is specified.
117 If an initial portion of the output file is seeked past (see the
120 the output file is truncated at that point.
121 .It Cm oseek Ns = Ns Ar n
122 Seek on the output file
125 This is synonymous with
126 .Cm seek Ns = Ns Ar n .
127 .It Cm seek Ns = Ns Ar n
130 blocks from the beginning of the output before copying.
131 On non-tape devices, an
134 Otherwise, existing blocks are read and the data discarded.
135 If the user does not have read permission for the tape, it is positioned
139 If the seek operation is past the end of file, space from the current
140 end of file to the specified offset is filled with blocks of
143 .It Cm skip Ns = Ns Ar n
146 blocks from the beginning of the input before copying.
147 On input which supports seeks, an
150 Otherwise, input data is read and discarded.
151 For pipes, the correct number of bytes is read.
152 For all other devices, the correct number of blocks is read without
153 distinguishing between a partial or complete block being read.
154 .It Cm conv Ns = Ns Ar value Ns Op , Ns Ar value ...
157 is one of the symbols from the following list.
158 .Bl -tag -width ".Cm unblock"
159 .It Cm ascii , oldascii
162 value except that characters are translated from
167 records are converted.
173 There are two conversion maps for
177 specifies the recommended one which is compatible with
181 specifies the one used in historic
184 .No pre- Ns Bx 4.3 reno
187 Treats the input as a sequence of newline or end-of-file terminated variable
188 length records independent of input and output block boundaries.
189 Any trailing newline character is discarded.
190 Each input record is converted to a fixed length output record where the
191 length is specified by the
194 Input records shorter than the conversion record size are padded with spaces.
195 Input records longer than the conversion record size are truncated.
196 The number of truncated input records, if any, are reported to the standard
197 error output at the completion of the copy.
198 .It Cm ebcdic , ibm , oldebcdic , oldibm
201 value except that characters are translated from
206 records are converted.
212 There are four conversion maps for
216 specifies the recommended one which is compatible with
220 is a slightly different mapping, which is compatible with the
228 are maps used in historic
231 .No pre- Ns Bx 4.3 reno
234 Transform uppercase characters into lowercase characters.
236 Do not stop processing on an input error.
237 When an input error occurs, a diagnostic message followed by the current
238 input and output block counts will be written to the standard error output
239 in the same format as the standard completion message.
242 conversion is also specified, any missing input data will be replaced
245 bytes (or with spaces if a block oriented conversion value was
246 specified) and processed as a normal input buffer.
249 conversion is not specified, the input block is omitted from the output.
250 On input files which are not tapes or pipes, the file offset
251 will be positioned past the block in which the error occurred using
254 Do not truncate the output file.
255 This will preserve any blocks in the output file not explicitly written
260 value is not supported for tapes.
262 Pad the final output block to the full output block size.
263 If the input file is not a multiple of the output block size
264 after conversion, this conversion forces the final output block
265 to be the same size as preceding blocks for use on devices that require
266 regularly sized blocks to be written.
267 This option is incompatible with use of the
269 block size specification.
271 If one or more output blocks would consist solely of
273 bytes, try to seek the output file by the required space instead of
276 resulting in a sparse file.
278 Swap every pair of input bytes.
279 If an input buffer has an odd number of bytes, the last byte will be
280 ignored during swapping.
282 Pad every input block to the input buffer size.
283 Spaces are used for pad bytes if a block oriented conversion value is
288 Transform lowercase characters into uppercase characters.
290 Treats the input as a sequence of fixed length records independent of input
291 and output block boundaries.
292 The length of the input records is specified by the
295 Any trailing space characters are discarded and a newline character is
300 Where sizes are specified, a decimal, octal, or hexadecimal number of
302 If the number ends with a
310 number is multiplied by 512, 1024 (1K), 1048576 (1M), 1073741824 (1G)
311 or the number of bytes in an integer, respectively.
312 Two or more numbers may be separated by an
314 to indicate a product.
318 displays the number of complete and partial input and output blocks,
319 truncated input records and odd-length byte-swapping blocks to the
320 standard error output.
321 A partial input block is one where less than the input block size
323 A partial output block is one where less than the output block size
325 Partial output blocks to tape devices are considered fatal errors.
326 Otherwise, the rest of the block will be written.
327 Partial output blocks to character devices will produce a warning message.
328 A truncated input block is one where a variable length record oriented
329 conversion value was specified and the input line was too long to
330 fit in the conversion record or was not newline terminated.
332 Normally, data resulting from input or conversion or both are aggregated
333 into output blocks of the specified size.
334 After the end of input is reached, any remaining output is written as
336 This means that the final output block may be shorter than the output
347 signal, the current input and output block counts will
348 be written to the standard error output
349 in the same format as the standard completion message.
354 signal, the current input and output block counts will
355 be written to the standard error output
356 in the same format as the standard completion message and
368 utility is expected to be a superset of the
381 values are extensions to the