NAME
dd - Converts and copies a file
SYNOPSIS
dd [option=value ...]
DESCRIPTION
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 quan-
tity 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 charac-
ters to ASCII, trims trailing spaces, and adds newline char-
acters 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, dd reports the number of whole and par-
tial input and output blocks.
Options
if=input_file
Specifies the input filename; standard input is the
default.
of=output_file
Specifies the output filename; standard output is the
default.
ibs=number
Specifies the input block size in bytes; the default is
512.
obs=number
Specifies the output block size in bytes; the default is
512.
bs=number
Specifies both the input and output block size,
superseding ibs and obs. If no conversion other than
sync and noerror is specified, each input block is
copied to the output as a single block without aggregat-
ing short blocks.
cbs=number
Specifies the conversion block size for block and
unblock in bytes. A value of 0 (zero) inhibits block
and unblock conversions.
skip=number
Skips number input records before starting copy.
files=number
Copies number input files before terminating (makes
sense only where input is a magnetic tape or similar
device).
seek=number
Seeks to the numberth record from the beginning of out-
put file before copying.
count=number
Copies only number input records.
conv=specification[,specification ...]
Specifies one or more of the following conversions:
ascii
Converts EBCDIC to ASCII.
block
Converts variable-length records to fixed-length.
ebcdic
Converts ASCII to EBCDIC.
ibm Performs a slightly different map of ASCII to
EBCDIC.
unblock
Converts fixed-length records to variable-length.
lcase
Makes all alphabetic characters lowercase letters.
ucase
Makes all alphabetic characters uppercase letters.
swab
Swaps every pair of bytes.
noerror
Does not stop processing on an error.
sync
Pads every input record to ibs.
... , ...
Allows several comma-separated conversions.
EXAMPLES
1. 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
Note the use of raw magnetic tape. dd is especially
suited to I/O on the raw physical devices because it
allows reading and writing in arbitrary record sizes.
2. To convert an ASCII text file to EBCDIC, enter:
dd if=text.ascii of=text.ebcdic conv=ebcdic
This converts text.ascii to EBCDIC representation,
storing this in text.ebcdic.
NOTES
1. The ASCII/EBCDIC conversion tables are taken from the
256 character standard in the CACM November, 1968.
There is no universal standard for EBCDIC/ASCII trans-
lation.
2. One must specify conv=noerror,sync when copying raw
disks with bad sectors to ensure dd stays synchronized.
3. Certain combinations of arguments to conv= are permit-
ted. However, the block or unblock option cannot be
combined with ascii, ebcdic, or ibm. Invalid combina-
tions silently ignore all but the last mutually
exclusive keyword.
4. If you need to use dd to copy to a streaming tape and
the data is an odd length (not a multiple of 512
bytes), you must use the conv=sync flag to fill the
last record. Streaming tape devices permit only multi-
ples of 512 bytes.
DIAGNOSTICS
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 ibs or obs. The number of partial
records read or written (p) refers to the blocks of data
smaller than ibs or obs.
The following message specifies the number of truncated
blocks:
n truncated block(s)
RELATED INFORMATION
Commands: cp(1), cpio(1), pax(1), tar(1), tr(1), trbsd(1).
"Using Internationalization Features" in the OSF/1 User's
Guide.
Acknowledgement and Disclaimer