<!doctypehtml><meta charset=utf-8><meta content=width=device-width,initial-scale=1.0 name=viewport><link href=/mandoc.css media=all rel=stylesheet><title>
   dd(1) - OpenBSD manual pages
  </title><body><section><h1><a href=https://www.openbsd.org/> OpenBSD </a> manual page server</h1></section><form action=/ autocapitalize=none autocomplete=off><fieldset><legend>Manual Page Search Parameters</legend><input name=query size=40 type=search value=dd><button name=apropos value=0>man</button><button name=apropos value=1>apropos</button><br><select name=sec><option value=0>All Sections<option value=1>1 - General Commands<option value=2>2 - System Calls<option value=3>3 - Library Functions<option value=3p>3p - Perl Library<option value=4>4 - Device Drivers<option value=5>5 - File Formats<option value=6>6 - Games<option value=7>7 - Miscellaneous Information<option value=8>8 - System Manager's Manual<option value=9>9 - Kernel Developer's Manual</select><select name=arch><option selected value=default>All Architectures<option>amd64<option>alpha<option>armv7<option>arm64<option>hppa<option>i386<option>landisk<option>loongson<option>luna88k<option>macppc<option>mips64<option>octeon<option>powerpc64<option>riscv64<option>sparc64<option>amiga<option>arc<option>armish<option>arm32<option>atari<option>aviion<option>beagle<option>cats<option>hppa64<option>hp300<option>ia64<option>mac68k<option>mvme68k<option>mvme88k<option>mvmeppc<option>palm<option>pc532<option>pegasos<option>pmax<option>powerpc<option>sgi<option>socppc<option>solbourne<option>sparc<option>sun3<option>vax<option>wgrisc<option>x68k<option>zaurus</select><select name=manpath><option selected>OpenBSD-current<option>OpenBSD-6.9<option>OpenBSD-6.8<option>OpenBSD-6.7<option>OpenBSD-6.6<option>OpenBSD-6.5<option>OpenBSD-6.4<option>OpenBSD-6.3<option>OpenBSD-6.2<option>OpenBSD-6.1<option>OpenBSD-6.0<option>OpenBSD-5.9<option>OpenBSD-5.8<option>OpenBSD-5.7<option>OpenBSD-5.6<option>OpenBSD-5.5<option>OpenBSD-5.4<option>OpenBSD-5.3<option>OpenBSD-5.2<option>OpenBSD-5.1<option>OpenBSD-5.0<option>OpenBSD-4.9<option>OpenBSD-4.8<option>OpenBSD-4.7<option>OpenBSD-4.6<option>OpenBSD-4.5<option>OpenBSD-4.4<option>OpenBSD-4.3<option>OpenBSD-4.2<option>OpenBSD-4.1<option>OpenBSD-4.0<option>OpenBSD-3.9<option>OpenBSD-3.8<option>OpenBSD-3.7<option>OpenBSD-3.6<option>OpenBSD-3.5<option>OpenBSD-3.4<option>OpenBSD-3.3<option>OpenBSD-3.2<option>OpenBSD-3.1<option>OpenBSD-3.0<option>OpenBSD-2.9<option>OpenBSD-2.8<option>OpenBSD-2.7<option>OpenBSD-2.6<option>OpenBSD-2.5<option>OpenBSD-2.4<option>OpenBSD-2.3<option>OpenBSD-2.2</select></fieldset></form><hr><table class=head><tbody><tr><td class=head-ltitle>DD(1)<td class=head-vol>General Commands Manual<td class=head-rtitle>DD(1)</table><div class=manual-text><section class=Sh><h1 class=Sh id=NAME><a class=permalink href=#NAME> NAME </a></h1><p class=Pp><code class=Nm>
      dd
     </code> — <span class=Nd> convert and copy a file </span></section><section class=Sh><h1 class=Sh id=SYNOPSIS><a class=permalink href=#SYNOPSIS> SYNOPSIS </a></h1><table class=Nm><tbody><tr><td><code class=Nm>
         dd
        </code><td>[ <var class=Ar> operand ... </var> ]</table></section><section class=Sh><h1 class=Sh id=DESCRIPTION><a class=permalink href=#DESCRIPTION> DESCRIPTION </a></h1><p class=Pp>The <code class=Nm>
      dd
     </code> utility copies the standard input to the standard output, applying any specified conversions. Input data is read and written in 512-byte blocks. If input reads are short, input from multiple reads are aggregated to form the output block. When finished, <code class=Nm>
      dd
     </code> displays the number of complete and partial input and output blocks and truncated input records to the standard error output.<p class=Pp>The following operands are available:<dl class=Bl-tag><dt id=if><a class=permalink href=#if> <code class=Cm>
        if
       </code> </a> = <var class=Ar> file </var><dd>Read input from <var class=Ar> file </var> instead of the standard input.<dt id=of><a class=permalink href=#of> <code class=Cm>
        of
       </code> </a> = <var class=Ar> file </var><dd>Write output to <var class=Ar> file </var> instead of the standard output. Any regular output file is truncated unless the <code class=Cm>
       notrunc
      </code> conversion value is specified. If an initial portion of the output file is skipped (see the <code class=Cm>
       seek
      </code> operand), the output file is truncated at that point.<dt id=ibs><a class=permalink href=#ibs> <code class=Cm>
        ibs
       </code> </a> = <var class=Ar> n </var><dd>Set the input block size to <var class=Ar> n </var> bytes instead of the default 512.<dt id=obs><a class=permalink href=#obs> <code class=Cm>
        obs
       </code> </a> = <var class=Ar> n </var><dd>Set the output block size to <var class=Ar> n </var> bytes instead of the default 512.<dt id=bs><a class=permalink href=#bs> <code class=Cm>
        bs
       </code> </a> = <var class=Ar> n </var><dd>Set both the input and output block size to <var class=Ar> n </var> bytes, superseding the <code class=Cm>
       ibs
      </code> and <code class=Cm>
       obs
      </code> operands. If no conversion values other than <code class=Cm>
       noerror
      </code> , <code class=Cm>
       notrunc
      </code> , or <code class=Cm>
       sync
      </code> are specified, then each input block is copied to the output as a single block without any aggregation of short blocks.<dt id=cbs><a class=permalink href=#cbs> <code class=Cm>
        cbs
       </code> </a> = <var class=Ar> n </var><dd>Set the conversion record size to <var class=Ar> n </var> bytes. The conversion record size is required by the record oriented conversion values.<dt id=count><a class=permalink href=#count> <code class=Cm>
        count
       </code> </a> = <var class=Ar> n </var><dd>Copy only <var class=Ar> n </var> input blocks.<dt id=files><a class=permalink href=#files> <code class=Cm>
        files
       </code> </a> = <var class=Ar> n </var><dd>Copy <var class=Ar> n </var> input files before terminating. This operand is only applicable when the input device is a tape.<dt id=seek><a class=permalink href=#seek> <code class=Cm>
        seek
       </code> </a> = <var class=Ar> n </var><dd>Seek <var class=Ar> n </var> blocks from the beginning of the output before copying. On non-tape devices, an <a class=Xr href=/lseek.2> lseek(2) </a> operation is used. Otherwise, existing blocks are read and the data discarded. If the user does not have read permission for the tape, it is positioned using the tape <a class=Xr href=/ioctl.2> ioctl(2) </a> function calls. If the seek operation is past the end of file, space from the current end of file to the specified offset is filled with blocks of NUL bytes.<dt id=skip><a class=permalink href=#skip> <code class=Cm>
        skip
       </code> </a> = <var class=Ar> n </var><dd>Skip <var class=Ar> n </var> blocks from the beginning of the input before copying. On input which supports seeks, an <a class=Xr href=/lseek.2> lseek(2) </a> operation is used. Otherwise, input data is read and discarded. For pipes, the correct number of bytes is read. For all other devices, the correct number of blocks is read without distinguishing between a partial or complete block being read.<dt id=status><a class=permalink href=#status> <code class=Cm>
        status
       </code> </a> = <var class=Ar> value </var><dd>The <var class=Ar> value </var> is one of the symbols from the following list: <dl class=Bl-tag><dt id=noxfer><a class=permalink href=#noxfer> <code class=Cm>
          noxfer
         </code> </a><dd>Do not print the transfer statistics as the last line of status output.<dt id=none><a class=permalink href=#none> <code class=Cm>
          none
         </code> </a><dd>Do not print the status output. Error messages are shown; informational messages are not.</dl><dt id=conv><a class=permalink href=#conv> <code class=Cm>
        conv
       </code> </a> = <var class=Ar> value </var> [, <var class=Ar> value ... </var> ]<dd>Each <var class=Ar> value </var> is one of the symbols from the following list: <dl class=Bl-tag><dt id=ascii><a class=permalink href=#ascii> <code class=Cm>
          ascii
         </code> </a><dd>The same as the <code class=Cm>
         unblock
        </code> value except that characters are translated from EBCDIC to ASCII before the records are converted. (These values imply <code class=Cm>
         unblock
        </code> if the operand <code class=Cm>
         cbs
        </code> is also specified.)<dt id=block><a class=permalink href=#block> <code class=Cm>
          block
         </code> </a><dd>Treats the input as a sequence of newline or end-of-file terminated variable length records independent of input and output block boundaries. Any trailing newline character is discarded. Each input record is converted to a fixed length output record where the length is specified by the <code class=Cm>
         cbs
        </code> operand. Input records shorter than the conversion record size are padded with spaces. Input records longer than the conversion record size are truncated. The number of truncated input records, if any, is reported to the standard error output at the completion of the copy.<dt id=ebcdic><a class=permalink href=#ebcdic> <code class=Cm>
          ebcdic
         </code> </a> , <code class=Cm>
         ibm
        </code><dd>The same as the <code class=Cm>
         block
        </code> value except that characters are translated from ASCII to EBCDIC after the records are converted. (These values imply <code class=Cm>
         block
        </code> if the operand <code class=Cm>
         cbs
        </code> is also specified.) There are two conversion maps for EBCDIC. The value <code class=Cm>
         ebcdic
        </code> specifies the recommended one which is compatible with <span class=Ux> AT&T System V UNIX </span> . The value <code class=Cm>
         ibm
        </code> is a slightly different mapping, which is compatible with the <span class=Ux> AT&T System V UNIX </span> <code class=Cm>
         ibm
        </code> value.<dt id=fsync><a class=permalink href=#fsync> <code class=Cm>
          fsync
         </code> </a><dd>Call <a class=Xr href=/fsync.2> fsync(2) </a> on the output file before exiting.<dt id=lcase><a class=permalink href=#lcase> <code class=Cm>
          lcase
         </code> </a><dd>Transform uppercase characters into lowercase characters.<dt id=noerror><a class=permalink href=#noerror> <code class=Cm>
          noerror
         </code> </a><dd>Do not stop processing on an input error. When an input error occurs, a diagnostic message followed by the current input and output block counts will be written to the standard error output in the same format as the standard completion message. If the <code class=Cm>
         sync
        </code> conversion is also specified, any missing input data will be replaced with NUL bytes (or with spaces if a block oriented conversion value was specified) and processed as a normal input buffer. If the <code class=Cm>
         sync
        </code> conversion is not specified, the input block is omitted from the output. On input files which are not tapes or pipes, the file offset will be positioned past the block in which the error occurred using <a class=Xr href=/lseek.2> lseek(2) </a> .<dt id=notrunc><a class=permalink href=#notrunc> <code class=Cm>
          notrunc
         </code> </a><dd>Do not truncate the output file. This will preserve any blocks in the output file not explicitly written by <code class=Nm>
         dd
        </code> . The <code class=Cm>
         notrunc
        </code> value is not supported for tapes.<dt id=osync><a class=permalink href=#osync> <code class=Cm>
          osync
         </code> </a><dd>Pad the final output block to the full output block size. This forces the final output block to be the same size as preceding blocks for use on devices that require regularly sized blocks to be written. This option is incompatible with the <code class=Cm>
         bs
        </code> block size specification.<dt id=swab><a class=permalink href=#swab> <code class=Cm>
          swab
         </code> </a><dd>Swap every pair of input bytes. If an input buffer has an odd number of bytes, the last byte will be ignored during swapping.<dt id=sync><a class=permalink href=#sync> <code class=Cm>
          sync
         </code> </a><dd>Pad every input block to the input buffer size. Spaces are used for pad bytes if a block oriented conversion value is specified, otherwise NUL bytes are used.<dt id=ucase><a class=permalink href=#ucase> <code class=Cm>
          ucase
         </code> </a><dd>Transform lowercase characters into uppercase characters.<dt id=unblock><a class=permalink href=#unblock> <code class=Cm>
          unblock
         </code> </a><dd>Treats the input as a sequence of fixed length records independent of input and output block boundaries. The length of the input records is specified by the <code class=Cm>
         cbs
        </code> operand. Any trailing space characters are discarded and a newline character is appended.</dl></dl><p class=Pp>Where sizes are specified, a decimal number of bytes is expected. If the number ends with a ‘b’, ‘k’ or ‘K’, ‘m’ or ‘M’, ‘g’ or ‘G’, or ‘w’, the number is multiplied by 512, 1024 (1K), 1048576 (1M), 1073741824 (1G), or the number of bytes in an integer, respectively. Two or more numbers may be separated by an ‘x’ to indicate a product.<p class=Pp>When finished, <code class=Nm>
      dd
     </code> displays the number of complete and partial input and output blocks, truncated input records, and odd-length byte-swapping blocks to the standard error output. A partial input block is one where less than the input block size was read. A partial output block is one where less than the output block size was written. Partial output blocks to tape devices are considered fatal errors. Otherwise, the rest of the block will be written. Partial output blocks to character devices will produce a warning message. A truncated input block is one where a variable length record oriented conversion value was specified and the input line was too long to fit in the conversion record or was not newline terminated.<p class=Pp>Normally, data resulting from input or conversion or both are aggregated into output blocks of the specified size. After the end of input is reached, any remaining output is written as a block. This means that the final output block may be shorter than the output block size.<p class=Pp>If <code class=Nm>
      dd
     </code> receives a <code class=Dv>
      SIGINFO
     </code> (see the “status” argument for <a class=Xr href=/stty.1> stty(1) </a> ) signal, the current input and output block counts will be written to the standard error output in the same format as the standard completion message. If <code class=Nm>
      dd
     </code> receives a <code class=Dv>
      SIGINT
     </code> signal, the current input and output block counts will be written to the standard error output in the same format as the standard completion message and <code class=Nm>
      dd
     </code> will exit.</section><section class=Sh><h1 class=Sh id=EXIT_STATUS><a class=permalink href=#EXIT_STATUS> EXIT STATUS </a></h1><p class=Pp>The <code class=Nm>
      dd
     </code> utility exits 0 on success, and >0 if an error occurs.</section><section class=Sh><h1 class=Sh id=EXAMPLES><a class=permalink href=#EXAMPLES> EXAMPLES </a></h1><p class=Pp>Write a bootable <span class=Ux> OpenBSD </span> disk image to a USB flash drive attached at <span class=Pa> /dev/sd3 </span> :<p class=Pp><div class="Bd Bd-indent"><code class=Li>
      # dd if=install68.img of=/dev/rsd3c
  bs=1m
     </code></div><p class=Pp>Create an ISO-9660 image of a CD-ROM:<p class=Pp><div class="Bd Bd-indent"><code class=Li>
      # dd if=/dev/rcd0c of=disk.iso
  bs=32k
     </code></div></section><section class=Sh><h1 class=Sh id=SEE_ALSO><a class=permalink href=#SEE_ALSO> SEE ALSO </a></h1><p class=Pp><a class=Xr href=/cp.1> cp(1) </a> , <a class=Xr href=/mt.1> mt(1) </a> , <a class=Xr href=/tr.1> tr(1) </a></section><section class=Sh><h1 class=Sh id=STANDARDS><a class=permalink href=#STANDARDS> STANDARDS </a></h1><p class=Pp>The <code class=Nm>
      dd
     </code> utility is compliant with the <span class=St> IEEE Std 1003.1-2008 (“POSIX.1”) </span> specification.<p class=Pp>The conversions <code class=Cm>
      ascii
     </code> , <code class=Cm>
      ebcdic
     </code> , and <code class=Cm>
      ibm
     </code> are marked by <span class=St> IEEE Std 1003.1-2008 (“POSIX.1”) </span> as being an X/Open System Interfaces option.<p class=Pp>The <code class=Cm>
      files
     </code> and <code class=Cm>
      status
     </code> operands, the <code class=Cm>
      fsync
     </code> and <code class=Cm>
      osync
     </code> conversions, the ‘K’, ‘m’, ‘M’, ‘g’, ‘G’, and ‘w’ size multipliers and <code class=Dv>
      SIGINFO
     </code> handling are all extensions to the <span class=St> IEEE Std 1003.1-2008 (“POSIX.1”) </span> specification.</section><section class=Sh><h1 class=Sh id=HISTORY><a class=permalink href=#HISTORY> HISTORY </a></h1><p class=Pp>A <code class=Nm>
      dd
     </code> utility appeared in <span class=Ux> Version 5 AT&T UNIX </span> .</section></div><table class=foot><tbody><tr><td class=foot-date>October 29, 2020<td class=foot-os>OpenBSD-current</table>