1 .\" $OpenBSD: dd.1,v 1.25 2011/10/18 09:37:35 nicm Exp $
2 .\" $NetBSD: dd.1,v 1.5 1995/03/21 09:04:04 cgd Exp $
4 .\" Copyright (c) 1990, 1993
5 .\" The Regents of the University of California. All rights reserved.
7 .\" This code is derived from software contributed to Berkeley by
8 .\" Keith Muller of the University of California, San Diego.
10 .\" Redistribution and use in source and binary forms, with or without
11 .\" modification, are permitted provided that the following conditions
13 .\" 1. Redistributions of source code must retain the above copyright
14 .\" notice, this list of conditions and the following disclaimer.
15 .\" 2. Redistributions in binary form must reproduce the above copyright
16 .\" notice, this list of conditions and the following disclaimer in the
17 .\" documentation and/or other materials provided with the distribution.
18 .\" 3. Neither the name of the University nor the names of its contributors
19 .\" may be used to endorse or promote products derived from this software
20 .\" without specific prior written permission.
22 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 .\" @(#)dd.1 8.2 (Berkeley) 1/13/94
36 .Dd $Mdocdate: October 18 2011 $
41 .Nd convert and copy a file
48 utility copies the standard input to the standard output, applying any
49 specified conversions.
50 Input data is read and written in 512-byte blocks.
51 If input reads are short, input from multiple reads are aggregated
52 to form the output block.
55 displays the number of complete and partial input and output blocks
56 and truncated input records to the standard error output.
58 The following operands are available:
59 .Bl -tag -width of=file
63 instead of the standard input.
67 instead of the standard output.
68 Any regular output file is truncated unless the
70 conversion value is specified.
71 If an initial portion of the output file is skipped (see the
74 the output file is truncated at that point.
76 Set the input block size to
78 bytes instead of the default 512.
80 Set the output block size to
82 bytes instead of the default 512.
84 Set both the input and output block size to
86 bytes, superseding the
91 If no conversion values other than
96 are specified, then each input block is copied to the output as a
97 single block without any aggregation of short blocks.
99 Set the conversion record size to
102 The conversion record size is required by the record oriented conversion
104 .It Cm count= Ns Ar n
108 .It Cm files= Ns Ar n
111 input files before terminating.
112 This operand is only applicable when the input device is a tape.
116 blocks from the beginning of the output before copying.
117 On non-tape devices, an
120 Otherwise, existing blocks are read and the data discarded.
121 If the user does not have read permission for the tape, it is positioned
125 If the seek operation is past the end of file, space from the current
126 end of file to the specified offset is filled with blocks of
132 blocks from the beginning of the input before copying.
133 On input which supports seeks, an
136 Otherwise, input data is read and discarded.
137 For pipes, the correct number of bytes is read.
138 For all other devices, the correct number of blocks is read without
139 distinguishing between a partial or complete block being read.
142 .Cm conv= Ar value Oo ,
148 is one of the symbols from the following list.
149 .Bl -tag -width unblock
150 .It Cm ascii , oldascii
153 value except that characters are translated from
158 records are converted.
164 There are two conversion maps for
168 specifies the recommended one which is compatible with System V.
171 specifies the one used in historic
173 and pre-4.3BSD-reno systems.
175 Treats the input as a sequence of newline or end-of-file terminated variable
176 length records independent of input and output block boundaries.
177 Any trailing newline character is discarded.
178 Each input record is converted to a fixed length output record where the
179 length is specified by the
182 Input records shorter than the conversion record size are padded with spaces.
183 Input records longer than the conversion record size are truncated.
184 The number of truncated input records, if any, is reported to the standard
185 error output at the completion of the copy.
186 .It Cm ebcdic , ibm , oldebcdic , oldibm
189 value except that characters are translated from
194 records are converted.
200 There are four conversion maps for
204 specifies the recommended one which is compatible with
208 is a slightly different mapping, which is compatible with the
216 are maps used in historic
218 and pre-4.3BSD-reno systems.
220 Transform uppercase characters into lowercase characters.
222 Do not stop processing on an input error.
223 When an input error occurs, a diagnostic message followed by the current
224 input and output block counts will be written to the standard error output
225 in the same format as the standard completion message.
228 conversion is also specified, any missing input data will be replaced
231 bytes (or with spaces if a block oriented conversion value was
232 specified) and processed as a normal input buffer.
235 conversion is not specified, the input block is omitted from the output.
236 On input files which are not tapes or pipes, the file offset
237 will be positioned past the block in which the error occurred using
240 Do not truncate the output file.
241 This will preserve any blocks in the output file not explicitly written
246 value is not supported for tapes.
248 Pad the final output block to the full output block size.
249 If the input file is not a multiple of the output block size
250 after conversion, this conversion forces the final output block
251 to be the same size as preceding blocks for use on devices that require
252 regularly sized blocks to be written.
253 This option is incompatible with use of the
255 block size specification.
257 Swap every pair of input bytes.
258 If an input buffer has an odd number of bytes, the last byte will be
259 ignored during swapping.
261 Pad every input block to the input buffer size.
262 Spaces are used for pad bytes if a block oriented conversion value is
267 Transform lowercase characters into uppercase characters.
269 Treats the input as a sequence of fixed length records independent of input
270 and output block boundaries.
271 The length of the input records is specified by the
274 Any trailing space characters are discarded and a newline character is
279 Where sizes are specified, a decimal number of bytes is expected.
280 If the number ends with a
291 is multiplied by 512, 1024 (1K), 1048576 (1M), or the number of bytes
292 in an integer, respectively.
293 Two or more numbers may be separated by an
295 to indicate a product.
299 displays the number of complete and partial input and output blocks,
300 truncated input records, and odd-length byte-swapping blocks to the
301 standard error output.
302 A partial input block is one where less than the input block size
304 A partial output block is one where less than the output block size
306 Partial output blocks to tape devices are considered fatal errors.
307 Otherwise, the rest of the block will be written.
308 Partial output blocks to character devices will produce a warning message.
309 A truncated input block is one where a variable length record oriented
310 conversion value was specified and the input line was too long to
311 fit in the conversion record or was not newline terminated.
313 Normally, data resulting from input or conversion or both are aggregated
314 into output blocks of the specified size.
315 After the end of input is reached, any remaining output is written as
317 This means that the final output block may be shorter than the output
328 signal, the current input and output block counts will
329 be written to the standard error output
330 in the same format as the standard completion message.
335 signal, the current input and output block counts will
336 be written to the standard error output
337 in the same format as the standard completion message and
345 floppy image to a floppy disk:
347 .Dl # dd if=floppy34.fs of=/dev/rfd0c bs=32k
349 Create an ISO-9660 image of a CD-ROM:
351 .Dl # dd if=/dev/rcd0c of=disk.iso bs=32k
359 utility is compliant with the
368 are compliant with the
381 and the size multipliers
387 are all extensions to those specifications.