1 .\" $NetBSD: dd.1,v 1.21 2007/04/13 00:38:45 lukem Exp $
3 .\" Copyright (c) 1990, 1993
4 .\" The Regents of the University of California. All rights reserved.
6 .\" This code is derived from software contributed to Berkeley by
7 .\" Keith Muller of the University of California, San Diego.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
17 .\" 3. Neither the name of the University nor the names of its contributors
18 .\" may be used to endorse or promote products derived from this software
19 .\" without specific prior written permission.
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .\" @(#)dd.1 8.2 (Berkeley) 1/13/94
40 .Nd convert and copy a file
47 utility copies the standard input to the standard output.
48 Input data is read and written in 512-byte blocks.
49 If input reads are short, input from multiple reads are aggregated
50 to form the output block.
53 displays the number of complete and partial input and output blocks
54 and truncated input records to the standard error output.
56 The following operands are available:
57 .Bl -tag -width of=file
59 Set both input and output block size, superseding the
64 If no conversion values other than
69 are specified, then each input block is copied to the output as a
70 single block without any aggregation of short blocks.
72 Set the conversion record size to
75 The conversion record size is required by the record oriented conversion
84 input files before terminating.
85 This operand is only applicable when the input device is a tape.
87 Set the input block size to
89 bytes instead of the default 512.
93 instead of the standard input.
95 Set the output block size to
97 bytes instead of the default 512.
101 instead of the standard output.
102 Any regular output file is truncated unless the
104 conversion value is specified.
105 If an initial portion of the output file is skipped (see the
108 the output file is truncated at that point.
112 blocks from the beginning of the output before copying.
113 On non-tape devices, a
116 Otherwise, existing blocks are read and the data discarded.
117 If the user does not have read permission for the tape, it is positioned
121 If the seek operation is past the end of file, space from the current
122 end of file to the specified offset is filled with blocks of
128 blocks from the beginning of the input before copying.
129 On input which supports seeks, a
132 Otherwise, input data is read and discarded.
133 For pipes, the correct number of bytes is read.
134 For all other devices, the correct number of blocks is read without
135 distinguishing between a partial or complete block being read.
136 .It Cm progress= Ns Ar n
137 Switch on display of progress if
139 is set to any non-zero value.
142 to be printed (to the standard error output) for every
144 full or partial blocks written to the output file.
146 .It Cm conv= Cm value Op \&, Cm value \&...
150 is one of the symbols from the following list.
151 .Bl -tag -width unblock
152 .It Cm ascii , oldascii
155 value except that characters are translated from
160 records are converted.
166 There are two conversion maps for
170 specifies the recommended one which is compatible with
174 specifies the one used in historic
180 Treats the input as a sequence of newline or end-of-file terminated variable
181 length records independent of input and output block boundaries.
182 Any trailing newline character is discarded.
183 Each input record is converted to a fixed length output record where the
184 length is specified by the
187 Input records shorter than the conversion record size are padded with spaces.
188 Input records longer than the conversion record size are truncated.
189 The number of truncated input records, if any, are reported to the standard
190 error output at the completion of the copy.
191 .It Cm ebcdic , ibm , oldebcdic , oldibm
194 value except that characters are translated from
199 records are converted.
205 There are four conversion maps for
209 specifies the recommended one which is compatible with
213 is a slightly different mapping, which is compatible with the
221 are maps used in historic
227 Transform uppercase characters into lowercase characters.
229 Do not stop processing on an input error.
230 When an input error occurs, a diagnostic message followed by the current
231 input and output block counts will be written to the standard error output
232 in the same format as the standard completion message.
235 conversion is also specified, any missing input data will be replaced
238 bytes (or with spaces if a block oriented conversion value was
239 specified) and processed as a normal input buffer.
242 conversion is not specified, the input block is omitted from the output.
243 On input files which are not tapes or pipes, the file offset
244 will be positioned past the block in which the error occurred using
247 Do not truncate the output file.
248 This will preserve any blocks in the output file not explicitly written
253 value is not supported for tapes.
255 Pad the final output block to the full output block size.
256 If the input file is not a multiple of the output block size
257 after conversion, this conversion forces the final output block
258 to be the same size as preceding blocks for use on devices that require
259 regularly sized blocks to be written.
260 This option is incompatible with use of the
262 block size specification.
264 If one or more non-final output blocks would consist solely of
266 bytes, try to seek the output file by the required space instead of
269 This results in a sparse file on some file systems.
271 Swap every pair of input bytes.
272 If an input buffer has an odd number of bytes, the last byte will be
273 ignored during swapping.
275 Pad every input block to the input buffer size.
276 Spaces are used for pad bytes if a block oriented conversion value is
281 Transform lowercase characters into uppercase characters.
283 Treats the input as a sequence of fixed length records independent of input
284 and output block boundaries.
285 The length of the input records is specified by the
288 Any trailing space characters are discarded and a newline character is
293 Where sizes are specified, a decimal number of bytes is expected.
294 Two or more numbers may be separated by an
296 to indicate a product.
297 Each number may have one of the following optional suffixes:
298 .Bl -tag -width 3n -offset indent -compact
300 Block; multiply by 512
302 Kibi; multiply by 1024 (1 KiB)
304 Mebi; multiply by 1048576 (1 MiB)
306 Gibi; multiply by 1073741824 (1 GiB)
308 Tebi; multiply by 1099511627776 (1 TiB)
310 Word; multiply by the number of bytes in an integer
315 displays the number of complete and partial input and output blocks,
316 truncated input records and odd-length byte-swapping blocks to the
317 standard error output.
318 A partial input block is one where less than the input block size
320 A partial output block is one where less than the output block size
322 Partial output blocks to tape devices are considered fatal errors.
323 Otherwise, the rest of the block will be written.
324 Partial output blocks to character devices will produce a warning message.
325 A truncated input block is one where a variable length record oriented
326 conversion value was specified and the input line was too long to
327 fit in the conversion record or was not newline terminated.
329 Normally, data resulting from input or conversion or both are aggregated
330 into output blocks of the specified size.
331 After the end of input is reached, any remaining output is written as
333 This means that the final output block may be shorter than the output
345 the current input and output block counts will
346 be written to the standard error output
347 in the same format as the standard completion message.
352 signal, the current input and output block counts will
353 be written to the standard error output
354 in the same format as the standard completion message and
360 utility exits 0 on success and \*[Gt]0 if an error occurred.
368 utility is expected to be a superset of the
381 values are extensions to the