Manual pages › System administration commands (1M)
dd(1M)
convert and copy a file
From the original Amiga UNIX 2.1 manual. Some things it mentions may not be in this release.
Also by this name: dd(1), General commands · dd(7A), Amiga-specific devices
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.
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 conver-
sion 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 incredibly slow)
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
ebcdic convert ASCII to EBCDIC
ibm slightly different map of ASCII to EBCDIC
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
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 block 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.
EXAMPLE
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/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.
SEE ALSO
cp(1)
NOTES
Do not use dd to copy files between filesystems having different 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.
DIAGNOSTICS
f+p records in(out) numbers of full and partial blocks read(written)