dd(1) dd(1)
NAME
dd - convert and copy files
SYNOPSIS
dd [option ...]
DESCRIPTION
The dd command can be used to copy files while making any necessary
conversions, e.g. from EBCDIC to ASCII or vice versa.
dd is well-suited for input/output via raw devices (raw physical I/O),
because it can read and write in blocks of any size. Note, however,
that any given raw device can only handle the block sizes for which it
is specifically designed (512-byte blocks for a floppy disk drive, for
example). If the size of the file you want to convert is not a multi-
ple of the appropriate block size, you must use the conv=sync option.
After completion, dd reports the number of whole and partial input and
output blocks on standard error.
Caution:
Never use dd to copy files between file systems which have dif-
ferent block sizes.
Using a block device to copy a file may result in extra nulls
being added to the file to pad the final block to the block boun-
dary.
OPTIONS
______________________________________________________________________
| Option | Brief description |
|________________|____________________________________________________|
| if=inputfile | Name of input file |
|________________|____________________________________________________|
| of=outputfile | Name of output file |
|________________|____________________________________________________|
| ibs=n | Input block size (in bytes) |
|________________|____________________________________________________|
| obs=n | Output block size (in bytes) |
|________________|____________________________________________________|
| bs=n | Input and output block size (in bytes) |
|________________|____________________________________________________|
| cbs=n | Conversion block size (in bytes) |
|________________|____________________________________________________|
| files=n | Number of files to be copied and concatenated |
|________________|____________________________________________________|
| skip=n | Skip first n blocks of input file |
|________________|____________________________________________________|
Page 1 Reliant UNIX 5.44 Printed 11/98
dd(1) dd(1)
______________________________________________________________________
| Option | Brief description |
|________________|____________________________________________________|
| iseek=n | Seek n blocks from beginning of input file before |
| | copying |
|________________|____________________________________________________|
| oseek=n | Seek n blocks from beginning of output file before|
| | copying |
|________________|____________________________________________________|
| seek=n | Seek n blocks from beginning of output file before|
| | copying |
|________________|____________________________________________________|
| count=n | Copy/convert only first n blocks of input file |
|________________|____________________________________________________|
| conv=...,... | Several values for conv |
|________________|____________________________________________________|
| conv=ascii | Convert from EBCDIC to ASCII |
|________________|____________________________________________________|
| conv=ebcdic | Convert from ASCII to EBCDIC |
|________________|____________________________________________________|
| conv=ibm | Convert from ASCII to IBM-specific EBCDIC |
|________________|____________________________________________________|
| conv=block | Convert newline-terminated records to fixed-length|
| | records |
|________________|____________________________________________________|
| conv=unblock | Convert fixed-length records to newline-terminated|
| | records |
|________________|____________________________________________________|
| conv=lcase | Convert uppercase letters to lowercase |
|________________|____________________________________________________|
| conv=ucase | Convert lowercase letters to uppercase |
|________________|____________________________________________________|
| conv=swab | Swap every pair of bytes |
|________________|____________________________________________________|
| conv=noerror | Do not stop processing on error |
|________________|____________________________________________________|
| conv=sync | Pad every input block to the number of characters |
| | defined in ibs=n |
|________________|____________________________________________________|
| conv=notrunc | Do not truncate the output file |
|________________|____________________________________________________|
No option specified:
dd reads from standard input and writes to standard output. No
conversions are performed. The input and output block sizes
default to 512 bytes.
Page 2 Reliant UNIX 5.44 Printed 11/98
dd(1) dd(1)
If size arguments are needed for an option, you can specify them as
follows:
n means n times 1
nb means n times 512
nk means n times 1024
nw means n times 2
nxm means n times m
n*m means n times m
if=inputfile
In inputfile you give the name of the input file from which dd
is to read.
if=inputfile not specified:
dd reads from standard input.
of=outputfile
outputfile designates the name of the output file to which dd is
to write.
of=outputfile not specified:
dd writes to standard output.
ibs=n
(input block size) In n you specify the input block size in
bytes.
ibs=n not specified:
The input block size defaults to 512 bytes.
obs=n
(output block size) In n you specify the output block size in
bytes.
obs=n not specified:
The output block size defaults to 512 bytes.
bs=n (block size) In n you specify a value in bytes for both the input
and output block size. The value specified for bs overrides the
values of ibs and obs.
bs=n not specified:
The input block size is preserved instead of packing short blocks
into the output buffer (this is particularly efficient since no
in-core copy need be done).
Page 3 Reliant UNIX 5.44 Printed 11/98
dd(1) dd(1)
cbs=n
(conversion block size) Specify the conversion block size for
block and unblock in bytes by n (default is zero). If cbs=n is
omitted or given a value of zero, using block or unblock produces
unspecified results.
This operand must also be specified if the conv= operand is
specified with a value of ascii, ebcdic or ibm. For a conv=
operand with an ascii value, the input is handled as described
for the unblock value except that characters are converted to
ASCII before any trailing space characters are deleted. For conv=
operands with ebcdic or ibm values, the input is handled as
described for the block value except that the characters are con-
verted to EBCDIC or IBM EBCDIC, respectively, after any trailing
space characters are added.
(see conv=ascii, conv=ebcdic, conv=ibm, conv=block and
conv=unblock).
files=n
In n you specify the number of files dd is to copy and concate-
nate before terminating. This option only makes sense when input
is from a magnetic tape unit or a similar device (such as a
streamer).
skip=n
The first n blocks of the input file are skipped, and copying
begins at block number n+1. This option is only appropriate for
magnetic tape, where iseek is undefined.
iseek=n
The first n blocks of the input file are skipped, and copying
begins at block number n+1. This option is specially designed for
disk files, where skip can be extremely slow. It is only accepted
with devices which support the lseek system call (such as disk
units).
skip and iseek are mutually exclusive.
oseek=n
The copy of the input file (after conversion, if specified)
begins n blocks into the output file (i.e. at block n+1). The
first n blocks of the output file remain unchanged. This options
is only accepted with devices which support the lseek system call
(such as disk units).
seek=n
seek performs the same function as oseek.
count=n
Only the first n blocks of the input file are copied (and con-
verted, if specified). If n is 0, the complete file is copied.
Page 4 Reliant UNIX 5.44 Printed 11/98
dd(1) dd(1)
conv=...,...
You can specify a number of values for conv, separated by commas,
and in this way bring about a number of conversions.
The values ascii, ebcdic, and ibm cannot be specified simultane-
ously. The same applies for the value pairs block and unblock, as
well as lcase and ucase.
conv=ascii
Conversion from EBCDIC to ASCII.
The number of characters defined in cbs=n is copied into the con-
version buffer and any specified character mapping is done.
Trailing blanks are removed, and a newline character is added.
The output block size of the file is thus adjusted to the value
defined in cbs=n. If cbs is unspecified or set to 0, input file
character mapping is done, but trailing blanks are not removed.
conv=ebcdic
Conversion from ASCII to EBCDIC.
The ASCII characters are read into the conversion buffer and con-
verted to EBCDIC. Trailing blanks are added in order to produce
the output block size defined in cbs=n. If cbs is unspecified or
set to 0, input file character mapping is done, but the file's
block structure is not changed.
conv=ibm
Conversion from ASCII to EBCDIC as described above, but using an
IBM-specific EBCDIC table.
conv=block
Conversion of newline-terminated ASCII records to fixed-length
records. The ASCII characters are read into the conversion
buffer, and blanks are added to adjust the record length or out-
put block size to the value defined in cbs=n. If cbs is unspeci-
fied or set to 0, this option produces a simple file copy.
conv=unblock
Conversion of fixed-length ASCII records to newline-terminated
records. The record length is determined by the value defined in
cbs=n. This number of characters is repeatedly read into the
conversion buffer, where excess trailing blanks are removed and a
newline character is added before the characters are sent to the
output. If cbs is unspecified or set to 0, this option produces a
simple file copy.
conv=lcase
Uppercase letters are converted to the corresponding lowercase
letters.
Page 5 Reliant UNIX 5.44 Printed 11/98
dd(1) dd(1)
conv=ucase
Lowercase letters are converted to the corresponding uppercase
letters.
conv=swab
The bytes in each pair of bytes are swapped. If an input block
contains an uneven number of bytes, the last byte is ignored.
conv=noerror
Processing is continued even if an error occurs.
conv=sync
Every input block is padded to the value specified in ibs=n. When
block or unblock is specified, blanks or null-bytes are used.
conv=notrunc
The output file is not regenerated. All blocks that are not over-
written explicitly by dd remain unchanged.
LOCALE
The LCMESSAGES environment variable governs the language in which
message texts are displayed. If LCMESSAGES is undefined or is defined
as the null string, it defaults to the value of LANG. If LANG is like-
wise undefined or null, the system acts as if it were not internation-
alized.
The LCALL environment variable governs the entire locale. LCALL
takes precedence over all the other environment variables which affect
internationalization.
EXAMPLES
The contents of an EBCDIC tape with a block structure of 10 times 80
bytes is to be written to the ASCII file xy:
$ dd if=/dev/rmt32 of=xy ibs=800 cbs=80 conv=ascii
SEE ALSO
cp(1).
Page 6 Reliant UNIX 5.44 Printed 11/98