dd(1M)


dd -- convert and copy a file

Synopsis

/u95/bin/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. dd processes supplementary code set characters according to the locale specified in the LC_CTYPE environment variable (see LANG on environ(5)), except as noted below.

option
values

if=file
input file name; standard input is default.

of=file
output file name; standard output is default. If the seek=expr conversion is not also specified, the output file will be truncated before the copy begins, unless conv=notrunc is specified. If the seek=expr conversion is specified, but conv=notrunc is not, the effect of the copy will be to preserve the blocks in the output file over which dd seeks, but no other portion of the output file will be preserved. (If the size of the seek plus the size of the input file is less than the previous size of the output file, the output file will be shortened by the copy.)

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 conversion 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 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=value,...
Perform character conversions as specified by one or more comma-separated value arguments, as follows:

ascii
convert EBCDIC to ASCII. Conversion results cannot be assured when supplementary code set characters are also subject to conversion. Cannot be specified with ebcdic or ibm.

ebcdic
convert ASCII to EBCDIC. Conversion results cannot be assured when supplementary code set characters are also subject to conversion. Cannot be specified with ascii or ibm.

ibm
slightly different map of ASCII to EBCDIC. Conversion results cannot be assured when supplementary code set characters are also subject to conversion. Cannot be specified with ascii or 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. Multibyte characters are not converted.

ucase
map alphabetics to upper case. Multibyte characters are not converted.

swab
swap every pair of bytes.

noerror
do not stop processing on an error (limit of 5 consecutive errors).

notrunc
Do not truncate the output file. Preserve blocks in the output file not explicitly written by this invocation of the dd utility. (See also the preceding of=file operand.)

sync
pad every input block to ibs, using spaces if conv=block os also specified, otherwise NULL characters.
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, ebcdic, ibm, block, or unblock 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.

Files


/usr/lib/locale/locale/LC_MESSAGES/uxcore.abi
language-specific message file (see LANG on environ(5)).

Usage

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* 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. Note also that /rmt* represents the raw magnetic tape device name.

Reading from magnetic tape in any fixed-length block length besides the block length that the media was written in originally will cause an I/O error. If you want to read a tape that was written using a block-length besides the default of 512, you must use the tapecntl(1) command to either set the block-length of the drive to match the block length of the media or to set the drive into variable block length mode.

Exit codes

The following messages are written to standard error.

n truncated block(s)
written only if n is larger than 0; if POSIX2 is set in the current environment, then n truncated record(s) is written instead

f+p records in(out)
numbers of full and partial blocks read(written)

References

cp(1)

Notices

Reading from magnetic tape in any fixed-length block length, besides the block length that the media was written in originally, will cause an I/O error. In order to read a tape that was written using some block length besides the default of 512, use the tapecntl(1) command to either set the block length of the drive to match the block length of the media, or to set the drive into variable block length mode.

Do not use dd to copy files between file systems having different block sizes.

dd does not always require block sizes that are in multiples of 512 bytes. Block size is device dependent. If input data blocks are not a multiple of 512, however, the read side will have no error messages, but the write side might have a ``write error'' message. dd transfers correctly if the input data block sizes are a multiple of 512.

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.

Using dd with a cartridge tape is not recommended.

Using variable-length block mode when writing magnetic tapes is discouraged because it may not work correctly in releases before SVR4.2 MP. Magnetic tape should always be written in fixed-length block mode, even though you are free to change the default fixed-block length from 512 bytes to any other fixed-block mode the tape drive supports.

This command has been updated to handle files greater than 2GB.


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 02 June 2005