BSD 4_4_Lite2 development
[unix-history] / usr / share / man / cat1 / dd.0
DD(1) BSD Reference Manual DD(1)
N\bNA\bAM\bME\bE
d\bdd\bd - convert and copy a file
S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
d\bdd\bd [operands ...]
D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
The d\bdd\bd utility copies the standard input to the standard output. Input
data is read and written in 512-byte blocks. If input reads are short,
input from multiple reads are aggregated to form the output block. When
finished, d\bdd\bd displays the number of complete and partial input and output
blocks and truncated input records to the standard error output.
The following operands are available:
b\bbs\bs=\b=_\bn Set both input and output block size, superseding the i\bib\bbs\bs and
o\bob\bbs\bs operands. If no conversion values other than n\bno\boe\ber\brr\bro\bor\br,
n\bno\bot\btr\bru\bun\bnc\bc or s\bsy\byn\bnc\bc are specified, then each input block is copied
to the output as a single block without any aggregation of short
blocks.
c\bcb\bbs\bs=\b=_\bn Set the conversion record size to _\bn bytes. The conversion
record size is required by the record oriented conversion val-
ues.
c\bco\bou\bun\bnt\bt=\b=_\bn Copy only _\bn input blocks.
f\bfi\bil\ble\bes\bs=\b=_\bn Copy _\bn input files before terminating. This operand is only ap-
plicable when the input device is a tape.
i\bib\bbs\bs=\b=_\bn Set the input block size to _\bn bytes instead of the default 512.
i\bif\bf=\b=_\bf_\bi_\bl_\be Read input from _\bf_\bi_\bl_\be instead of the standard input.
o\bob\bbs\bs=\b=_\bn Set the output block size to _\bn bytes instead of the default 512.
o\bof\bf=\b=_\bf_\bi_\bl_\be Write output to _\bf_\bi_\bl_\be instead of the standard output. Any regu-
lar output file is truncated unless the n\bno\bot\btr\bru\bun\bnc\bc conversion value
is specified. If an initial portion of the output file is
skipped (see the s\bse\bee\bek\bk operand) the output file is truncated at
that point.
s\bse\bee\bek\bk=\b=_\bn Seek _\bn blocks from the beginning of the output before copying.
On non-tape devices, a lseek(2) operation is used. Otherwise,
existing blocks are read and the data discarded. If the user
does not have read permission for the tape, it is positioned us-
ing the tape ioctl(2) function calls. If the seek operation is
past the end of file, space from the current end of file to the
specified offset is filled with blocks of NUL bytes.
s\bsk\bki\bip\bp=\b=_\bn Skip _\bn blocks from the beginning of the input before copying.
On input which supports seeks, a lseek(2) operation is used.
Otherwise, input data is read and discarded. For pipes, the
correct number of bytes is read. For all other devices, the
correct number of blocks is read without distinguishing between
a partial or complete block being read.
c\bco\bon\bnv\bv=\b= v\bva\bal\blu\bue\be[, v\bva\bal\blu\bue\be .\b..\b..\b.]
Where v\bva\bal\blu\bue\be is one of the symbols from the following list.
a\bas\bsc\bci\bii\bi, o\bol\bld\bda\bas\bsc\bci\bii\bi
The same as the u\bun\bnb\bbl\blo\boc\bck\bk value except that characters
are translated from ECBDIC to ASCII before the records
are converted. (These values imply u\bun\bnb\bbl\blo\boc\bck\bk if the
operand c\bcb\bbs\bs is also specified.) There are two conver-
sion maps for ASCII. The value a\bas\bsc\bci\bii\bi specifies the rec-
ommended one which is compatible with System V. The
value o\bol\bld\bda\bas\bsc\bci\bii\bi specifies the one used in historic AT&T
and pre-4.3BSD-reno systems.
b\bbl\blo\boc\bck\bk Treats the input as a sequence of newline or end-of-
file terminated variable length records independent of
input and output block boundaries. Any trailing new-
line character is discarded. Each input record is con-
verted to a fixed length output record where the length
is specified by the c\bcb\bbs\bs operand. Input records shorter
than the conversion record size are padded with spaces.
Input records longer than the conversion record size
are truncated. The number of truncated input records,
if any, are reported to the standard error output at
the completion of the copy.
e\beb\bbc\bcd\bdi\bic\bc, i\bib\bbm\bm, o\bol\bld\bde\beb\bbc\bcd\bdi\bic\bc, o\bol\bld\bdi\bib\bbm\bm
The same as the b\bbl\blo\boc\bck\bk value except that characters are
translated from ASCII to EBCDIC after the records are
converted. (These values imply b\bbl\blo\boc\bck\bk if the operand
c\bcb\bbs\bs is also specified.) There are four conversion maps
for EBCDIC. The value e\beb\bbc\bcd\bdi\bic\bc specifies the recommended
one which is compatible with AT&T System V UNIX. The
value i\bib\bbm\bm is a slightly different mapping, which is
compatible with the AT&T System V UNIX i\bib\bbm\bm value. The
values o\bol\bld\bde\beb\bbc\bcd\bdi\bic\bc and o\bol\bld\bdi\bib\bbm\bm are maps used in historic
AT&T and pre-4.3BSD-reno systems.
l\blc\bca\bas\bse\be Transform uppercase characters into lowercase charac-
ters.
n\bno\boe\ber\brr\bro\bor\br Do not stop processing on an input error. When an in-
put error occurs, a diagnostic message followed by the
current input and output block counts will be written
to the standard error output in the same format as the
standard completion message. If the s\bsy\byn\bnc\bc conversion is
also specified, any missing input data will be replaced
with NUL bytes (or with spaces if a block oriented con-
version value was specified) and processed as a normal
input buffer. If the s\bsy\byn\bnc\bc conversion is not specified,
the input block is omitted from the output. On input
files which are not tapes or pipes, the file offset
will be positioned past the block in which the error
occurred using lseek(2).
n\bno\bot\btr\bru\bun\bnc\bc Do not truncate the output file. This will preserve
any blocks in the output file not explicitly written by
d\bdd\bd. The n\bno\bot\btr\bru\bun\bnc\bc value is not supported for tapes.
o\bos\bsy\byn\bnc\bc Pad the final output block to the full output block
size. If the input file is not a multiple of the out-
put block size after conversion, this conversion forces
the final output block to be the same size as preceding
blocks for use on devices that require regularly sized
blocks to be written. This option is incompatible with
use of the b\bbs\bs=\b=_\bn block size specification.
s\bsw\bwa\bab\bb Swap every pair of input bytes. If an input buffer has
an odd number of bytes, the last byte will be ignored
during swapping.
s\bsy\byn\bnc\bc Pad every input block to the input buffer size. Spaces
are used for pad bytes if a block oriented conversion
value is specified, otherwise NUL bytes are used.
u\buc\bca\bas\bse\be Transform lowercase characters into uppercase charac-
ters.
u\bun\bnb\bbl\blo\boc\bck\bk Treats the input as a sequence of fixed length records
independent of input and output block boundaries. The
length of the input records is specified by the c\bcb\bbs\bs
operand. Any trailing space characters are discarded
and a newline character is appended.
Where sizes are specified, a decimal number of bytes is expected. If the
number ends with a ``b'', ``k'', ``m'' or ``w'', the number is multiplied
by 512, 1024 (1K), 1048576 (1M) or the number of bytes in an integer, re-
spectively. Two or more numbers may be separated by an ``x'' to indicate
a product.
When finished, d\bdd\bd displays the number of complete and partial input and
output blocks, truncated input records and odd-length byte-swapping
blocks to the standard error output. A partial input block is one where
less than the input block size was read. A partial output block is one
where less than the output block size was written. Partial output blocks
to tape devices are considered fatal errors. Otherwise, the rest of the
block will be written. Partial output blocks to character devices will
produce a warning message. A truncated input block is one where a vari-
able length record oriented conversion value was specified and the input
line was too long to fit in the conversion record or was not newline ter-
minated.
Normally, data resulting from input or conversion or both are aggregated
into output blocks of the specified size. After the end of input is
reached, any remaining output is written as a block. This means that the
final output block may be shorter than the output block size.
If d\bdd\bd receives a SIGINFO (see the ``status'' argument for stty(1)) sig-
nal, the current input and output block counts will be written to the
standard error output in the same format as the standard completion mes-
sage. If d\bdd\bd receives a SIGINT signal, the current input and output block
counts will be written to the standard error output in the same format as
the standard completion message and d\bdd\bd will exit.
The d\bdd\bd utility exits 0 on success and >0 if an error occurred.
S\bSE\bEE\bE A\bAL\bLS\bSO\bO
cp(1), mt(1), tr(1)
S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
The d\bdd\bd utility is expected to be a superset of the IEEE Std1003.2
(``POSIX'') standard. The f\bfi\bil\ble\bes\bs operand and the a\bas\bsc\bci\bii\bi, e\beb\bbc\bcd\bdi\bic\bc, i\bib\bbm\bm,
o\bol\bld\bda\bas\bsc\bci\bii\bi, o\bol\bld\bde\beb\bbc\bcd\bdi\bic\bc and o\bol\bld\bdi\bib\bbm\bm values are extensions to the POSIX stan-
dard.
4.4BSD January 13, 1994 3