1 .\" $NetBSD: dd.1,v 1.27 2015/03/18 13:30:13 wiz 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.
94 .It Cm iflag= Ns Ar flags
100 The possible values are
104 specified as lowercase and with the leading
109 .It Cm iseek= Ns Ar n
110 Seek on the input file
113 This is synonymous with
115 .It Cm msgfmt= Ns Ar fmt
116 Specify the message format
118 to be used when writing information to standard output.
120 .Bl -tag -width xxxxx -offset indent -compact
122 turns off information summary report except for errors and
125 default information summary report as specified by POSIX.
127 default information summary report extended with human-readable
133 does not correspond to any value given above,
134 it contains a string that will be used as format specifier
135 for the information summary output.
136 Each conversion specification is introduced by the character
138 The following ones are available:
139 .Bl -tag -width xx -offset indent -compact
141 total number of bytes transferred
143 total number of bytes transferred in
144 .Xr humanize_number 3
150 .Xr humanize_number 3
153 number of partial input block(s)
155 number of full input block(s)
157 number of partial output block(s)
159 number of full output block(s)
161 time elapsed since the beginning in
165 number of sparse output blocks
167 number of truncated blocks
169 number of odd-length swab blocks
173 depending on number of sparse blocks
177 depending on number of truncated blocks
181 depending on number of swab blocks
184 Set the output block size to
186 bytes instead of the default 512.
187 .It Cm of= Ns Ar file
190 instead of the standard output.
191 Any regular output file is truncated unless the
193 conversion value is specified.
194 If an initial portion of the output file is skipped (see the
197 the output file is truncated at that point.
198 .It Cm oflag= Ns Ar flags
206 which should be explicitly added in
208 in order to output to a nonexistent file.
209 The default or specified value is or'ed with
213 attempt, then on failure with
218 is automatically added if none of
224 .It Cm oseek= Ns Ar n
225 Seek on the output file
228 This is synonymous with
233 blocks from the beginning of the output before copying.
234 On non-tape devices, an
237 Otherwise, existing blocks are read and the data discarded.
238 If the user does not have read permission for the tape, it is positioned
242 If the seek operation is past the end of file, space from the current
243 end of file to the specified offset is filled with blocks of
249 blocks from the beginning of the input before copying.
250 On input which supports seeks, an
253 Otherwise, input data is read and discarded.
254 For pipes, the correct number of bytes is read.
255 For all other devices, the correct number of blocks is read without
256 distinguishing between a partial or complete block being read.
257 .It Cm progress= Ns Ar n
258 Switch on display of progress if
260 is set to any non-zero value.
263 to be printed (to the standard error output) for every
265 full or partial blocks written to the output file.
267 .It Cm conv= Cm value Op \&, Cm value \&...
271 is one of the symbols from the following list.
272 .Bl -tag -width unblock
273 .It Cm ascii , oldascii
276 value except that characters are translated from
281 records are converted.
287 There are two conversion maps for
291 specifies the recommended one which is compatible with
295 specifies the one used in historic
301 Treats the input as a sequence of newline or end-of-file terminated variable
302 length records independent of input and output block boundaries.
303 Any trailing newline character is discarded.
304 Each input record is converted to a fixed length output record where the
305 length is specified by the
308 Input records shorter than the conversion record size are padded with spaces.
309 Input records longer than the conversion record size are truncated.
310 The number of truncated input records, if any, are reported to the standard
311 error output at the completion of the copy.
312 .It Cm ebcdic , ibm , oldebcdic , oldibm
315 value except that characters are translated from
320 records are converted.
326 There are four conversion maps for
330 specifies the recommended one which is compatible with
334 is a slightly different mapping, which is compatible with the
342 are maps used in historic
348 Transform uppercase characters into lowercase characters.
350 Do not stop processing on an input error.
351 When an input error occurs, a diagnostic message followed by the current
352 input and output block counts will be written to the standard error output
353 in the same format as the standard completion message.
356 conversion is also specified, any missing input data will be replaced
359 bytes (or with spaces if a block oriented conversion value was
360 specified) and processed as a normal input buffer.
363 conversion is not specified, the input block is omitted from the output.
364 On input files which are not tapes or pipes, the file offset
365 will be positioned past the block in which the error occurred using
368 Do not truncate the output file.
369 This will preserve any blocks in the output file not explicitly written
374 value is not supported for tapes.
376 Pad the final output block to the full output block size.
377 If the input file is not a multiple of the output block size
378 after conversion, this conversion forces the final output block
379 to be the same size as preceding blocks for use on devices that require
380 regularly sized blocks to be written.
381 This option is incompatible with use of the
383 block size specification.
385 If one or more non-final output blocks would consist solely of
387 bytes, try to seek the output file by the required space instead of
390 This results in a sparse file on some file systems.
392 Swap every pair of input bytes.
393 If an input buffer has an odd number of bytes, the last byte will be
394 ignored during swapping.
396 Pad every input block to the input buffer size.
397 Spaces are used for pad bytes if a block oriented conversion value is
402 Transform lowercase characters into uppercase characters.
404 Treats the input as a sequence of fixed length records independent of input
405 and output block boundaries.
406 The length of the input records is specified by the
409 Any trailing space characters are discarded and a newline character is
414 Where sizes are specified, a decimal number of bytes is expected.
415 Two or more numbers may be separated by an
417 to indicate a product.
418 Each number may have one of the following optional suffixes:
419 .Bl -tag -width 3n -offset indent -compact
421 Block; multiply by 512
423 Kibi; multiply by 1024 (1 KiB)
425 Mebi; multiply by 1048576 (1 MiB)
427 Gibi; multiply by 1073741824 (1 GiB)
429 Tebi; multiply by 1099511627776 (1 TiB)
431 Word; multiply by the number of bytes in an integer
436 displays the number of complete and partial input and output blocks,
437 truncated input records and odd-length byte-swapping blocks to the
438 standard error output.
439 A partial input block is one where less than the input block size
441 A partial output block is one where less than the output block size
443 Partial output blocks to tape devices are considered fatal errors.
444 Otherwise, the rest of the block will be written.
445 Partial output blocks to character devices will produce a warning message.
446 A truncated input block is one where a variable length record oriented
447 conversion value was specified and the input line was too long to
448 fit in the conversion record or was not newline terminated.
450 Normally, data resulting from input or conversion or both are aggregated
451 into output blocks of the specified size.
452 After the end of input is reached, any remaining output is written as
454 This means that the final output block may be shorter than the output
466 the current input and output block counts will
467 be written to the standard error output
468 in the same format as the standard completion message.
473 signal, the current input and output block counts will
474 be written to the standard error output
475 in the same format as the standard completion message and
481 utility exits 0 on success and \*[Gt]0 if an error occurred.
483 To print summary information in human-readable form:
485 .Dl dd if=/dev/zero of=/dev/null count=1 msgfmt=human
487 To customize the information summary output and print it through
490 .Bd -literal -offset indent
491 dd if=/dev/zero of=/dev/null count=1 \e
492 msgfmt='speed:%E, in %s seconds\en' 2\*[Gt]\*[Am]1 | unvis
501 utility is expected to be a superset of the
516 values are extensions to the