dd
[option=
value]Make a copy of an input file (if=
), or standard input if no named input file, using the specified conditions, and send the results to the output file (or standard output if of
is not specified). Any number of options can be supplied, although if
and of
are the most common and are usually specified first. Because dd can handle arbitrary block sizes, it is useful when converting between raw physical devices.
bs=
nSet input and output block size to n bytes; this option supersedes ibs
and obs
.
cbs
=nSet the size of the conversion buffer (logical record length) to n bytes. Use only if the conversion flag is ascii
, asciib
, ebcdic
, ebcdicb
, ibm
, ibmb
, block
, or unblock
.
conv=
flagsConvert the input according to one or more (comma-separated) flags listed below. The first six flags are mutually exclusive. The next two are mutually exclusive with each other, as are the following two.
ascii | EBCDIC to ASCII. |
asciib | EBCDIC to ASCII, using BSD-compatible conversions. Solaris only. |
ebcdic | ASCII to EBCDIC. |
ebcdicb | ASCII to EBCDIC, using BSD-compatible conversions. Solaris only. |
ibm | ASCII to EBCDIC with IBM conventions. |
ibmb | ASCII to EBCDIC with IBM conventions, using BSD-compatible conversions. Solaris only. |
block | Variable-length records (i.e., those terminated by a newline) to fixed-length records. |
unblock | Fixed-length records to variable-length. |
lcase | Uppercase to lowercase. |
ucase | Lowercase to uppercase. |
noerror | Continue processing when errors occur (up to five in a row). |
notrunc | Do not truncate the output file. This preserves blocks in the output file that this invocation of dd did not write. Solaris only. |
swab | Swap all pairs of bytes. |
sync | Pad input blocks to |
count
=nCopy only n input blocks.
files
=nCopy n input files (e.g., from magnetic tape), then quit.
ibs
=nSet input block size to n bytes (default is 512).
if
=fileRead input from file (default is standard input).
obs
=nSet output block size to n bytes (default is 512).
of
=fileWrite output to file (default is standard output).
iseek
=nSeek n blocks from start of input file (like skip
but more efficient for disk file input).
oseek
=nSeek n blocks from start of output file.
seek
=nSame as oseek
(retained for compatibility).
skip
=nSkip n input blocks; useful with magnetic tape.
You can multiply size values (n) by a factor of 1024, 512, or 2 by appending the letters k
, b
, or w
, respectively. You can use the letter x
as a multiplication operator between two numbers.
Convert an input file to all lowercase:
dd if=caps_file of=small_file conv=lcase
Retrieve variable-length data; write it as fixed-length to out:
data_retrieval_cmd| dd of=out conv=sync,block