dd(1)
NAME
dd − convert, reblock, translate, and copy a (tape) 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. Input and output block size can be specified to take advantage of raw physical I/O.
Options
dd recognizes the following option=value pairs:
if=file Input file name; default is standard input.
of=file Output file name; default is standard output. The output file will be created using the same owner and group used by creat().
ibs=n Input block size is n bytes (default 512).
obs=n Output block size is n bytes (default 512).
bs=n Set both input and output block size to the same size, superseding ibs and obs. This option is particularly efficient if no conversion is specified, because no in-core copy is necessary.
cbs=n Conversion buffer size is n bytes.
skip=n Skip n input blocks before starting copy.
seek=n Seek n blocks from beginning of output file before copying. This option is ignored on a raw magnetic tape device. See mt(1) for information about operations on raw magnetic tape devices.
count=n Copy only n input blocks.
conv=option Data conversion option. Use one of the following:
conv=ascii Convert EBCDIC to ASCII.
conv=ebcdic Convert ASCII to EBCDIC
conv=ibm Convert ASCII to EBCDIC using an alternate conversion table
conv=lcase Map US ASCII alphabetics to lowercase
conv=ucase Map US ASCII alphabetics to uppercase
conv=swab Swap every pair of bytes
conv=noerror Do not stop processing on an error
conv=sync Pad every input block to input block size (ibs)
conv=notrunc Do not truncate existing file on output
conv=block Convert input record to a fixed length specified by cbs
conv=unblock Convert fixed length records to variable length
conv=..., ... Multiple comma-separated conversions
Where sizes are required, n indicates a numerical value in bytes. Numbers can be specified using the forms:
n for n bytes
nk for n Kbytes (n × 1024),
nb for n blocks (n × 512), or
nw for n words (n × 2).
To indicate a product, use x to separate number pairs.
The cbs option is used when block , unblock , ascii or ebcdic conversion is specified. In case of ascii , cbs characters are placed into the conversion buffer, converted to ASCII, trailing blanks are trimmed, and a new-line is added before sending the line to the output. In case of ebcdic , ASCII characters are read into the conversion buffer, converted to EBCDIC, and blanks are added to make up an output block of size cbs.
Upon completion, dd reports the number of whole and partial input and output records.
EXTERNAL INFLUENCES
International Code Set Support
Single- and multi-byte character code sets are supported.
Environment Variables
The following environment variables will affect execution of dd :
LANG : This variable determines the locale when LC_ALL and a corresponding variable (beginning with LC_ ) do not specify a locale.
LC_ALL : This variable determines the locale used to override any values set by LANG or any environment variables beginning with LC_ .
LC_CTYPE : This variable determines the locale for the interpretation of sequences of bytes of text data as characters ( single/multiple byte characters, upper/lower case characters ).
LC_MESSAGES : This variable determines the language in which messages should be written.
RETURN VALUE
Exit values are:
0 Successful completion.
>0 Error condition occurred.
DIAGNOSTICS
f+p records in Number of full and partial blocks read.
f+p records out Number of full and partial blocks written.
EXAMPLES
Read an EBCDIC tape blocked ten 80-byte EBCDIC card images per block into an ASCII file named x:
dd if=/dev/rmt/0m of=x ibs=800 cbs=80 conv=ascii,lcase
Note the use of the raw magnetic tape device file. dd is especially suited to I/O on raw physical devices because it allows reading and writing in arbitrary block sizes.
WARNINGS
You may experience trouble writing directly to or reading directly from a cartridge tape. For best results, use tcio(1) as an input or output filter. For example, use
... |dd ... |tcio -ovVS 256 /dev/rct/c0
for output to a cartridge tape, or
tcio -ivS 256 /dev/rct/c0 |dd ... | ...
for input from a cartridge tape.
Some devices, such as 1/2-inch magnetic tapes, are incapable of seeking. Such devices must be positioned prior to running dd by using mt(1) or some other appropriate command.
ASCII and EBCDIC conversion tables are taken from the 256-character ACM standard, Nov, 1968. The ibm conversion, while less widely accepted as a standard, corresponds better to certain IBM print train conventions. There is no universal solution.
New-line characters are inserted only on conversion to ASCII; padding is done only on conversion to EBCDIC. These should be separate options.
If if or of refers to a disk section of greater than 2 Gbytes and a block size greater than 2 Kbytes is specified, dd prints an error message and exits.
SEE ALSO
STANDARDS CONFORMANCE
dd: SVID2, XPG2, XPG3, POSIX.2
Hewlett-Packard Company — HP-UX Release 9.0: August 1992