NAME [Toc] [Back]
dd - convert, reblock, translate, and copy a (tape) file
SYNOPSIS [Toc] [Back]
dd [option=value] ...
DESCRIPTION [Toc] [Back]
dd copies the specified input file to the specified output file with
possible conversions. The standard input and output are used by
default. Input and output block size can be specified to take
advantage of raw physical I/O. Upon completion, dd reports the number
of whole and partial input and output records.
Options [Toc] [Back]
dd recognizes the following option=value pairs:
if=file Input file name; default is standard input.
of=file Output file name; default is standard output. The
output file is created using the same owner and
group used by creat().
ibs=n Input block size is n bytes; default is 512.
obs=n Output block size is n bytes; default is 512.
bs=n Set both input and output block size to the same
size, superseding ibs and obs. This option is
particularly efficient if no conversion (conv
option) is specified, because no in-core copy is
cbs=n Conversion buffer size is n bytes.
skip=n Skip n input blocks before starting copy.
iseek=n Skip n input blocks before starting copy. (This
is an alias for the skip option.)
seek=n Skip n blocks from beginning of output file before
oseek=n Skip n blocks from beginning of output file before
copying. (This is an alias for the seek option.)
count=n Copy only n input blocks.
files=n Copy and concatenate n input files. This option
should be used only when the input file is a
magnetic tape device.
Hewlett-Packard Company - 1 - HP-UX 11i Version 2: August 2003
conv=value [,value ...]
Where values are comma-separated symbols from the
ascii Convert EBCDIC to ASCII.
ebcdic Convert ASCII to EBCDIC.
ibm Convert ASCII to EBCDIC using an
alternate conversion table.
The ascii, ebcdic, and ibm
values are mutually exclusive.
block Convert each newline-terminated
or end-of-file-terminated input
record to a record with a fixed
length specified by cbs. Any
newline character is removed,
and space characters are used to
fill the block to size cbs.
Lines that are longer than cbs
are truncated; the number of
truncated lines (records) is
reported (see DIAGNOSTICS
The block and unblock values are
unblock Convert fixed-length input
records to variable-length
records. For each input record,
cbs bytes are read, trailing
space characters are deleted,
and a newline character is
lcase Map upper-case input characters
to the corresponding lower-case
The lcase and ucase values are
ucase Map lower-case input characters
to the corresponding upper-case
swab Swap every pair of input bytes.
Hewlett-Packard Company - 2 - HP-UX 11i Version 2: August 2003
noerror Do not stop processing on an
input error. If the sync
conversion symbol is also
specified, missing input is
replaced with null bytes and
processed normally; otherwise,
the input block is omitted from
notrunc Do not truncate existing output
file. Blocks in the output file
not overwritten by this
invocation of dd are preserved.
sync Pad every input block to size
ibs. If block or unblock is
also specified, pad with space
characters; otherwise, pad with
Where sizes are required, n indicates a numerical value in bytes.
Numbers can be specified using the forms:
n for n bytes
nk for n Kbytes (n x 1024),
nb for n blocks (n x 512), or
nw for n words (n x 2).
To indicate a product, use x to separate number pairs.
The cbs option is used when block, unblock, ascii or ebcdic conversion
is specified. In case of ascii, cbs characters are placed into the
conversion buffer, converted to ASCII, trailing blanks are trimmed,
and a newline is added before sending the line to the output. In case
of ebcdic, ASCII characters are read into the conversion buffer,
converted to EBCDIC, and blanks are added to make up an output block
of size cbs.
EXTERNAL INFLUENCES [Toc] [Back]
International Code Set Support
Single- and multi-byte character code sets are supported.
Environment Variables [Toc] [Back]
The following environment variables affect execution of dd:
LANG determines the locale when LC_ALL and a corresponding variable
(beginning with LC_) do not specify a locale.
LC_ALL determines the locale used to override any values set by LANG
or any environment variables beginning with LC_.
Hewlett-Packard Company - 3 - HP-UX 11i Version 2: August 2003
The LC_CTYPE variable determines the locale for the interpretation of
sequences of bytes of text data as characters (single-byte/multi-byte
characters, upper-case/lower-case characters).
The LC_MESSAGES variable determines the language in which messages are
RETURN VALUE [Toc] [Back]
Exit values are:
0 Successful completion.
>0 Error condition occurred.
DIAGNOSTICS [Toc] [Back]
Upon completion, dd reports the number of input and output records:
f+p records in Number of full and partial blocks read.
f+p records out Number of full and partial blocks
When conv=block is specified and there is at least one truncated
block, the number of truncated records is also reported:
n truncated records
EXAMPLES [Toc] [Back]
Read an EBCDIC tape blocked ten 80-byte EBCDIC card images per block
into an ASCII file named x:
dd if=/dev/rmt/c0t0d0BEST of=x ibs=800 cbs=80 conv=ascii,lcase
Note the use of the raw magnetic tape device file. dd is especially
suited to I/O on raw physical devices because it allows reading and
writing in arbitrary block sizes.
WARNINGS [Toc] [Back]
Some devices, such as 1/2-inch magnetic tapes, are incapable of
seeking. Such devices may be positioned prior to running dd by using
mt(1) or some other appropriate command. The skip, seek, iseek and
oseek options do work for such devices. However, skipping blocks
using these options is slow on devices that cannot seek, since the
blocks must actually be read to get to the desired position on the
ASCII and EBCDIC conversion tables are taken from the 256-character
ACM standard, Nov, 1968. The ibm conversion, while less widely
accepted as a standard, corresponds better to certain IBM print train
conventions. There is no universal solution.
Newline characters are inserted only on conversion to ASCII; padding
is done only on conversion to EBCDIC. These should be separate
Hewlett-Packard Company - 4 - HP-UX 11i Version 2: August 2003
If if or of refers to a raw disk, bs should always be a multiple of
the sector size of the disk. By default, bs is 512 bytes. If the
sector size of the disk is different from 512 bytes, bs should be
specified using a multiple of sector size. The character special
(raw) device file should always be used for devices.
It is entirely up to the user to insure there is enough room in the
destination file, file system and/or device to contain the output
since dd cannot pre-determine the required space after conversion.
SEE ALSO [Toc] [Back]
cp(1), mt(1), tr(1), disk(7), mt(7).
STANDARDS CONFORMANCE [Toc] [Back]
dd: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2
Hewlett-Packard Company - 5 - HP-UX 11i Version 2: August 2003 [ Back ]