dd - Converts and copies a file
Interfaces documented on this reference page conform to industry standards as follows:
dd: XPG4, XPG4-UNIX
Refer to the
reference page for more information
about industry standards and associated tags.
operand set may take any of the following forms:
Specifies the input file name; standard input is the default.
Specifies the output file name; standard output is the default.
Specifies the input block size in bytes; the default is 512.
Specifies the output block size in bytes; the default is 512.
Specifies both the input and output block size, superseding
Specifies the conversion buffer size.
input records before
before terminating (makes sense only where input is a magnetic tape or similar
[Compaq] Seeks to the
record from the beginning of input file before copying.
[Compaq] Seeks to the
record from the beginning of output file before copying. Same as
Seeks to the
numberth record from
the beginning of output file before copying. Same as
Specifies one or more of the following conversions:
Converts EBCDIC to ASCII.
Converts variable-length records to fixed-length.
Converts ASCII to EBCDIC.
Converts IBM-EBCDIC to ASCII.
Performs a slightly different map of ASCII to EBCDIC.
Converts fixed-length records to variable-length.
Makes all alphabetic characters lower case.
Makes all alphabetic characters upper case.
Swaps every pair of bytes.
Does not stop processing on an error.
Pads every input record to
[Compaq] Creates a sparse output file as described in
Do not truncate the output file. Preserve blocks in the output
file not explicitly written by this invocation of the
utility. (See the
Allows several comma-separated conversions.
The dd command reads the specified input file or standard input, does the specified conversions, and copies it to the specified output file or standard output. The input and output block size may be specified to take advantage of raw physical I/O. The terms block and record refer to the quantity of data read or written by dd in one operation and are not necessarily the same size as a disk block.
Where sizes are specified, a number of bytes is expected. A number may end with w, b, or k to specify multiplication by 2, 512, or 1024, respectively; a pair of numbers can be separated by an x to indicate a product.
The cbs specification is used if one of the following conversions is specified: ascii, unblock, ebcdic, ibm, or block. For the first two conversions, dd places characters in a conversion buffer of size cbs, converts these characters to ASCII, trims trailing spaces, and adds newline characters before sending data to the specified output. For the latter three cases, dd places ASCII characters in the conversion buffer, converts these characters to EBCDIC, and adds trailing spaces to create an output record of size cbs.
After it finishes,
reports the number of whole
and partial input and output blocks.
[Compaq] To copy to a raw disk, the disk label must first be zeroed using the disklabel -z command. For example: disklabel -z rz17
[Compaq] Any file system archive that contains ACLs (access control
lists) that was created using
is not exportable unless
the target system has the exact same password and group files. If there is
a mismatch, incorrect access may be granted to a file or directory.
The following exit values are returned:
The input file was successfully copied.
An error occurred
This message specifies the number of full and partial records both read and written:
f+p records in f+p records out
The number of full records read or written (f)
refers to the blocks of data of size
obs. The number of partial records read or written (p) refers to the blocks of data smaller than
To read an EBCDIC tape blocked ten 80-byte EBCDIC card images per record into the ASCII file x, enter: dd if=/dev/rmt0 of=x ibs=800 cbs=80 conv=ascii,lcase
The following environment variables affect the execution of
Provides a default value for the internationalization variables
that are unset or null. If
is unset or null, the corresponding value from the default locale is used.
If any of the internationalization variables contain an invalid setting, the
utility behaves as if none of the variables had been defined.
If set to a non-empty string value, overrides the values of
all the other internationalization variables.
Determines the locale for the interpretation of sequences
of bytes of text data as characters (for example, single-byte as opposed to
multibyte characters in arguments).
Determines the locale for the format and contents of diagnostic
messages written to standard error.
Determines the location of message catalogues for the processing
Commands: cp(1), cpio(1), sed(1), tar(1), tr(1), trbsd(1)
Command and Shell User's Guide