convert and copy a file
dd [ option=value ] ...
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 size may be specified to take
advantage of raw physical I/O.
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 a product.
Input filename; standard input is default.
Output filename; standard output is default. This option truncates
an existing file to zero bytes in length unless
conv=notrunc is specified.
Input block size is n bytes (default is BSIZE
Output block size (default is BSIZE block size).
Sets both input and output block size, superseding ibs and
obs. If no conversion is specified, it is particularly
efficient since no in-core copy needs to be done.
Conversion buffer size.
Skips n input records before starting copy. (The records
are read but not output.)
Seeks n records from beginning of output file before
Same as skip, but seeks over the records instead of
As for seek.
Specify the number of input files to concatenate. This option
effectively causes a sequence of n EOFs to be
ignored. (It is generally only useful for tape.)
Copies only n input records.
value may be one or more (comma-separated) of the
Convert ASCII to unblocked ASCII.
Convert unblocked ASCII to ASCII.
Put the named device (whether block or character)
into block mode.
This is desirable for access to devices
with capacity beyond 2GB.
If you specify block size (bs) with bmode,
it must be a multiple of 512-byte blocks.
Converts EBCDIC to ASCII.
Converts ASCII to EBCDIC.
Slightly different map of ASCII to EBCDIC.
Input is to be memory mapped. (Input must be a regular file or block
Maps alphabetic characters to lowercase.
Input and output are to be memory mapped. (Both input and output
must be a regular file or block special device.)
Output is to be memory mapped. (Both input and output must be a
regular file or block special device.)
Maps alphabetic characters to uppercase.
Swaps every pair of bytes.
Does not stop processing on an error.
Do not truncate the output file. dd preserves existing
blocks in the output file that are not written to explicitly.
Pads every input record to ibs.
Nulls are used for the pad character unless conv=block or
conv=unblock has been specified, in which case spaces are used.
... , ...
Several comma-separated conversions.
cbs is used only if ascii, ebcdic, or
ibm conversion is specified. In the former case,
cbs characters are placed into the conversion buffer,
converted to ASCII, and trailing blanks trimmed and
newline added before sending the line to the output. In the latter
two cases, ASCII characters are read into the conversion
buffer, converted to EBCDIC, and blanks added to make up
an output record of size cbs.
After completion, dd reports the number of whole and
partial input and output blocks.
dd returns the following values:
the input file was copied successfully
an error occurred
Numbers of full and partial blocks read in the current input block
Numbers of full and partial blocks written in the current output
Numbers of blocks that were truncated because they overflowed the
These messages are written to the standard error output.
The first example reads an EBCDIC tape, blocked ten
80-byte EBCDIC card images per record, into the
ASCII file outfile:
dd if=/dev/rct0 of=outfile ibs=800 cbs=80 conv=ascii,lcase
Note the use of raw magtape. dd is especially suited to
I/O on raw physical devices because it allows reading and
writing in arbitrary record sizes.
The next example shows how to copy the contents of one floppy disk
to another, using /tmp as a temporary storage area. The
source disk is inserted in the drive, and the following command
dd if=/dev/rfd0 of=/tmp/tempfile
Next the source disk is removed from the drive, and the destination
disk inserted. The data in the temporary file,
/tmp/tempfile, may now be copied to this disk:
dd if=/tmp/tempfile of=/dev/rfd0
Finally remove the temporary file:
To archive onto block devices
(divisions. partitions, or whole disks)
larger than 2GB, pipe
output through the dd command:
find . -depth -print | cpio -ovcC8192 | dd of=/dev/my_spare_division conv=bmode bs=8k
To read an archive from a block device larger than 2GB,
read the data with the dd command
and pipe its output to the
dd if=/dev/my_spare_division conv=bmode bs=8k | cpio -ivcC8192
Previous versions of dd did not truncate an existing
output file. Existing scripts that rely on this functionality should
be amended to use the conversion conv=notrunc.
The ASCII/EBCDIC conversion tables are taken from the
256-character standard in the CACM Nov,
1968. The ibm conversion corresponds better to
certain IBM print train conventions. There is no universal
Newlines are inserted only on conversion to ASCII; padding
is done only on conversion to EBCDIC.
When using dd with a raw device, specify the block size as
a multiple of 1KB. For example, to use a 9KB
block size, enter:
dd if=file of=/dev/rct0 bs=18b
You could also enter:
dd if=file of=/dev/rct0 bs=9k
Open UNIX 8 compatibility notes
When running ACP on Open UNIX 8 and UnixWare 7 systems,
set OSRCMDS=on to use
the SCO OpenServer version of the <dd> command.
This provides the expected behaviors
for SCO OpenServer applications.
The SCO OpenServer version of this command
is also provided on Open UNIX 8 systems under the OSP feature
Running SCO OpenServer Applications
topic in the Open UNIX 8 documentation set.
dd is conformant with:
ISO/IEC DIS 99452:1992, Information technology Portable Operating System Interface (POSIX) Part 2: Shell and Utilities (IEEE Std 1003.21992);
AT&T SVID Issue 2;
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003