dd(1M) dd(1M)
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. dd processes
supplementary code set characters according to the locale
specified in the LC_CTYPE environment variable [see LANG on
environ(5)], except as noted below.
option values
if=file input file name; standard input is default.
of=file 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,
superseding 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 since no in-core copy need be done).
cbs=n conversion buffer size (logical record
length).
files=n copy and concatenate n input files before
terminating (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 slow).
Copyright 1994 Novell, Inc. Page 1
dd(1M) dd(1M)
oseek=n seek n blocks from beginning of output file
before copying.
seek=n identical to oseek, retained for backward
compatibility.
count=n copy only n input blocks.
conv=ascii convert EBCDIC to ASCII. Conversion results
cannot be assured when supplementary code set
characters are also subject to conversion.
ebcdic convert ASCII to EBCDIC. Conversion
results cannot be assured when
supplementary code set characters are
also subject to conversion.
ibm slightly different map of ASCII to
EBCDIC. Conversion results cannot be
assured when supplementary code set
characters are also subject to
conversion.
conv=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.
Multibyte characters are not
converted.
ucase map alphabetics to upper case.
Multibyte characters are not
converted.
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.
Copyright 1994 Novell, Inc. Page 2
dd(1M) dd(1M)
several comma-separated conversions.
Where sizes are specified, a number of bytes is expected. A
number may end with k, b, or w to specify multiplication by
1024, 512, or 2, respectively; a pair of numbers may be
separated by x to indicate multiplication.
cbs is used only if ascii, unblock, ebcdic ibm, or lock
conversion is specified. In the first two cases, cbs
characters 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
the output. In the latter three cases, characters are read
into the conversion buffer and blanks are added to make up an
output record of size cbs. If cbs is unspecified or zero, the
ascii, ebcdic, and ibm options convert the character set
without changing the block structure of the input file; the
unblock and block options become a simple file copy.
After completion, dd reports the number of whole and partial
input and output blocks.
USAGE
This command will read an EBCDIC tape blocked ten 80-byte
EBCDIC card images per tape block into the ASCII file x:
dd if=/dev/rmt* 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. Note also that /rmt*
represents the raw magnetic tape device name.
Reading from magnetic tape in any fixed-length block length
besides the block length that the media was written in
originally will cause an I/O error. If you want to read a
tape that was written using a block-length besides the default
of 512, you must use the tapecntl(1) command ( qv ) to either
set the block-length of the drive to match the block length of
the media or to set the drive into variable block length mode.
Errors
The following messages are written to standard error.
Copyright 1994 Novell, Inc. Page 3
dd(1M) dd(1M)
n truncated block(s) written only if n is larger than 0
f+p records in(out) numbers of full and partial blocks
read(written)
Files
/usr/lib/locale/locale/LC_MESSAGES/uxcore.abi
language-specific message file [see LANG on environ(5)].
REFERENCES
cp(1)
NOTICES
Reading from magnetic tape in any fixed-length block length,
besides the block length that the media was written in
originally, will cause an I/O error. In order to read a tape
that was written using some block length besides the default
of 512, use the tapecntl(1) command (qv) to either set the
block length of the drive to match the block length of the
media, or to set the drive into variable block length mode.
Do not use dd to copy files between file systems having
different block sizes.
dd does not always require block sizes that are in multiples
of 512 bytes. Block size is device dependent. If input data
blocks are not a multiple of 512, however, the read side will
have no error messages, but the write side might have a
``write error'' message. dd transfers correctly if the input
data block sizes are a multiple of 512.
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.
Using dd with a cartridge tape is not recommended.
Using variable-length block mode when writing magnetic tapes
is discouraged because it may not work correctly in releases
before SVR4.2 MP. Magnetic tape should always be written in
fixed-length block mode, even though you are free to change
the default fixed-block length from 512 bytes to any other
fixed-block mode the tape drive supports.
Copyright 1994 Novell, Inc. Page 4