NAME
dd - convert and copy a file
SYNOPSIS
dd [ option=value ] ...
DESCRIPTION
dd copies the specified input file to the specified output
with possible conversions. The standard input and output
are used by default. The input and output block sizes may
be specified to take advantage of raw physical I/O. Sizes
are specified in bytes; a number may end with k, b, or w to
specify multiplication by 1024, 512, or 2, respectively.
Or, numbers may be separated by x to indicate multiplica-
tion.
cbs is used only if ascii, unblock, ebcdic, ibm, or block
conversion is specified. In the first two cases, cbs char-
acters are copied into the conversion buffer, any specified
character mapping is done, trailing blanks are trimmed, and
a new-line is added before sending the line to output. In
the last three cases, characters up to new-line are read
into the conversion buffer and blanks are added to make up
an output record of size cbs. ASCII files are presumed to
contain new-line characters. If cbs is unspecified or zero,
the ascii, ebcdic, and ibm options convert the character set
without changing the input file's block structure; the
unblock and block options become a simple file copy.
After completion, dd reports the number of whole and partial
input and output blocks.
OPTIONS
if=filename Input file name; standard input is default.
of=filename Output file name; standard output is default.
ibs=n Input block size n bytes (default 512).
obs=n Output block size n bytes (default 512).
bs=n Set both input and output block size, supersed-
ing ibs and obs. Also, if no conversion is
specified, preserve the input block size
instead of packing short blocks into the output
buffer (this is particularly efficient because
it reduces in-memory copying).
cbs=n Conversion buffer size (logical record length).
files=n Copy and concatenate n input files before ter-
minating (makes sense only where input is a
magnetic tape or similar device).
skip=n Skip n input blocks before starting copy
(appropriate for magnetic tape, where iseek is
undefined).
iseek=n Seek n blocks from beginning of input file
before copying (appropriate for disk files,
where skip can be incredibly slow).
oseek=n Seek n blocks from beginning of output file
before copying.
seek=n Identical to oseek, retained for backward com-
patibility.
count=n Copy only n input blocks.
conv=ascii Convert EBCDIC to ASCII.
ebcdic Convert ASCII to EBCDIC. If converting fixed-
length ASCII records without new-lines, set up
a pipeline with dd conv=unblock beforehand.
ibm Slightly different map of ASCII to EBCDIC. For
fixed-length ASCII records without new-lines,
see above.
block Convert new-line terminated ASCII records to
fixed length.
unblock Convert fixed length ASCII records to new-line
terminated records.
lcase Map alphabetics to lower case.
ucase Map alphabetics to upper case.
swab Swap every pair of bytes.
noerror Do not stop processing on an error (limit of 5
consecutive errors).
sync Pad every input block to ibs.
... , ...
Several comma-separated conversions.
EXAMPLES
This command will read an EBCDIC tape blocked ten 80-byte
EBCDIC card images per tape block into the ASCII file x:
example% dd if=/dev/rmt/0h of=x ibs=800 obs=8k 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 block sizes.
ENVIRONMENT
If any of the LC_* variables ( LC_CTYPE, LC_MESSAGES,
LC_TIME, LC_COLLATE, LC_NUMERIC, and LC_MONETARY ) (see
environ(5)) are not set in the environment, the operational
behavior of dd for each corresponding locale category is
determined by the value of the LANG environment variable.
If LC_ALL is set, its contents are used to override both the
LANG and the other LC_* variables. If none of the above
variables are set in the environment, the "C" (U.S. style)
locale determines how dd behaves.
LC_CTYPE Determines how dd handles characters. When
LC_CTYPE is set to a valid value, dd can
display and handle text and filenames con-
taining valid characters for that locale. dd
can display and handle Extended Unix Code
(EUC) characters where any individual charac-
ter can be one, two, or three bytes wide. dd
can also handle EUC characters of one, two,
or more column widths. In the "C" locale,
only characters from ISO 8859-1 are valid.
LC_MESSAGES Determines how diagnostic and informative
messages are presented. This includes the
language and style of the messages, and the
correct form of affirmative and negative
responses. In the "C" locale, the messages
are presented in the default form found in
the program itself (in most cases, U.S.
English).
SEE ALSO
cp(1), environ(5)
DIAGNOSTICS
f+p records in(out) numbers of full and partial blocks
read(written)
NOTES
Do not use dd to copy files between filesystems having dif-
ferent block sizes.
Using a blocked device to copy a file will result in extra
nulls being added to the file to pad the final block to the
block boundary.
When dd reads from a pipe, using the ibs=X and obs=Y
operands, the output will always be blocked in chunks of
size Y. When bs=Z is used, the output blocks will be what-
ever was available to be read from the pipe at the time.