DD(1)

NAME
dd - convert and copy files with various data formats

SYNOPSIS
dd [ option=value ] ...

DESCRIPTION
dd copies a specified input file to a specified output with possible conversions. The standard input and output are used by default. The input and output block size may be specified to take advantage of raw physical I/O.

OPTIONS

if=name
    Input file is taken from name; standard input is default.

of=name
    Output file is taken from name; standard output is default. Note: dd creates an explicit output file; therefore the seek option is usually useless with explicit output except in special cases such as using magnetic tape or raw disk files.

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, it is particularly efficient since no copy need be done. Block sizes for the Sun386i are 9k for 3.5-inch floppy disks, and 126b (blocks) for quarter-inch tapes.

cbs=n
    Conversion buffer size.

skip=n
    Skip n input records before starting copy

files=n
    Copy n input files before terminating (makes sense only when input is a magtape or similar device).

seek=n
    Seek n records from beginning of output file before copying. This option generally only works with magnetic tapes and raw disk files and is otherwise usually useless if the explicit output file was named with the of option.

count=n
    Copy only n input records.

conv=ascii
    Convert EBCDIC to ASCII.
conv='u'ebcdic
    Convert ASCII to EBCDIC.
conv='u'ibm
    Slightly different map of ASCII to EBCDIC.
conv='u'block
    Convert variable length records to fixed length.
conv='u'unblock
    Convert fixed length records to variable length.
conv='u'lcase
    Map alphabetics to lower case.
conv='u'ucase
    Map alphabetics to upper case.
conv='u'swab
    Swap every pair of bytes.
conv='u'noerror
    Do not stop processing on an error.
conv='u'sync
    Pad every input record to ibs.
conv='u'arg, arg[,...]
    Several comma-separated conversions, for a combination of effects. For instance, conv=sync,block is useful for reading variable-length output from a pipe.

Where sizes are specified, a number of bytes is expected. A number may end with k (kilobytes) to specify multiplication by 1024, b (blocks of 512 bytes) to specify multiplication by 512, or w (words) to specify multiplication by 4; a pair of numbers may be separated by x to indicate a product.

cbs is used only if ascii, unblock, ebcdic, ibm, or block conversion is specified. In the first two cases, cbs characters are placed into the conversion buffer, any specified character mapping is done, trailing blanks trimmed and NEWLINE added before sending the line to the output. In the latter three cases, characters are read into the conversion buffer, and blanks added to make up an output record of size cbs.

After completion, dd reports the number of whole and partial input and output blocks.

EXAMPLES

To read an EBCDIC tape blocked ten 80-byte EBCDIC card images per record into the ASCII file x:

    example% dd if=/dev/rmt0 of=x ibs=800 cbs=80 conv=ascii,lcase

Note: the use of raw magtape: dd is especially suited to I/O on the raw physical devices because it allows reading and writing in arbitrary record sizes.

Sun386i EXAMPLES
The following write the file filename to a 3.5-inch floppy and read from the floppy into a file filename, respectively:

    example%  dd  if=filename of=/dev/rfd0c bs=9k
    example%  dd  if=/dev/rfd0c of=filename bs=9k

Sun386i files names are shown in fdformat(1).

SEE ALSO
cp(1), fdformat(1), tr(1V)

DIAGNOSTICS

f+p records in(out):
    Numbers of full and partial records read(written).

BUGS
The ASCII/EBCDIC conversion tables are taken from the 256 character standard in the CACM Nov, 1968. The ibm conversion, while less blessed as a standard, corresponds better to certain IBM print train conventions. There is no universal solution.

The block and unblock options cannot be combined with the ascii, ebcdic or ibm. Invalid combinations silently ignore all but the last mutually-exclusive keyword.