Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cp(1)

tr(1)

nbuf(4)

dd(1)

Name

dd − copy and convert data

Syntax

dd [option = value...]

Description

The dd command copies an input file to an output with any requested conversions.  The dd command is especially suited to I/O on the raw physical devices because it allows reading and writing in arbitrary record sizes.

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

This utility supports EOT handling which allows the use of multiple media.  The utility prompts for the next volume when it encounters the end of the current volume. 

Options

Where sizes (n) are given for an option, the number may end with k for kilobytes (1024 bytes), b for blocks (512 bytes), or w for words (2 bytes).  Also, two numbers may be separated by the character x to indicate a product. 

if=nameInput file name.  The standard input is the default. 

of=nameOutput file name.  The standard output is the default. 

ibs=nInput block size, n bytes. The default is 512 bytes.  Some devices do not support greater than 65,535 bytes. 

obs=nOutput block size, n bytes.  The default is 512 bytes.  Some devices do not support greater than 65,535 bytes. 

bs=nSet both input and output block size to n bytes, superseding ibs and obs.  Also, if bs is specified, the copy is more efficient, since no blocking conversion is necessary. 

cbs=nConversion buffer size, n bytes.  Use only if ascii, unblock, ebcdic, ibm, or block conversion is specified.  For ascii and unblock, n characters are placed into the conversion buffer, any specified character mapping is done, trailing blanks are trimmed and new line added before sending the line to the output.  For ebcdic, ibm, or block, characters are read into the conversion buffer, and blanks added to make an output record of size n bytes. 

skip=nSkip n input records before starting to copy. 

files=nCopy n input files before terminating.  This option is useful only when the input is a magnetic tape or similar device. 

seek=nSeek n records from beginning of output file before copying. 

rbuf=nUse n buffers for reading from those raw devices that support n-buffered I/O.  (See Section 4 to check whether a specific device supports n-buffered I/O.)  All n reads are started and each read must complete before the data can be used.  This allows an n-buffered read-ahead on supported raw devices. 

A default of eight read buffers are used if the read device supports n-buffered I/O and the write device does not. 

The rbuf option cannot be used with the wbuf option. 

wbuf=nUse n buffers for writing from those raw devices that support n-buffered I/O.  (See Section 4 to check whether a specific device supports n-buffered I/O.)  Each write is started but not known to be complete until all n buffers have been used.  (This allows an n-buffered write-behind on supported raw devices). 

A default of eight write buffers are used if the write device supports n-buffered I/O. 

The wbuf option cannot be used with the rbuf option. 

count=nCopy only n input records. 

conv=asciiConvert EBCDIC to ASCII. 

conv=ebcdicConvert ASCII to EBCDIC. 

conv=ibmSlightly different map of ASCII to EBCDIC (see RESTRICTIONS). 

conv=blockConvert variable length records to fixed length. 

conv=unblockConvert fixed length records to variable length. 

conv=lcaseMap alphabetics to lower case. 

conv=ucaseMap alphabetics to upper case. 

conv=swabSwap every pair of bytes. 

conv=noerrorDo not stop processing on an error. 

conv=syncPad every input record to ibs.

conv=nomultiDisable multiple tape volumes. 

conv=sparseCreate a sparse output file. 

conv=... , ...Include several arguments for the conv option, separated by commas (see example below). 

Examples

The following example shows how to read an EBCDIC tape blocked ten 80-byte EBCDIC card images per record into the ASCII file x:

dd if=/dev/rmt0h of=x ibs=800 cbs=80 conv=ascii,lcase

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

Restrictions

The ASCII/EBCDIC conversion tables are taken from the 256-character standard in the Communications of the ACM, November, 1968. 

The ibm conversion corresponds to certain IBM print train conventions. 

One must specify “conv=noerror,sync” when copying raw disks with bad sectors to ensure that dd stays synchronized. 
On SCSI tape devices when reading a multi-volume tape set the command will exit normally upon hitting EOT on any volume rather than automatically unloading the volume and prompting for the next volume as is normal. The user should load the next volume and issue the command anew.

Diagnostics

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

See Also

cp(1), tr(1), nbuf(4)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026