home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


dd

dd [option = value ]

Make a copy of an input file (if= ), or standard input if no named input file, using the specified conditions, and send the results to the output file (or standard output if of is not specified). Any number of options can be supplied, although if and of are the most common and are usually specified first. Because dd can handle arbitrary block sizes, it is useful when converting between raw physical devices.

Options

bs= n

Set input and output block size to n bytes; this option supersedes ibs and obs .

cbs =n

Set the size of the conversion buffer (logical record length) to n bytes. Use only if the conversion flag is ascii , asciib , ebcdic , ebcdicb , ibm , ibmb , block , or unblock .

conv= flags

Convert the input according to one or more (comma-separated) flags listed below. The first six flags are mutually exclusive. The next two are mutually exclusive with each other, as are the following two.

ascii

EBCDIC to ASCII.

asciib

EBCDIC to ASCII, using BSD-compatible conversions. Solaris only.

ebcdic

ASCII to EBCDIC.

ebcdicb

ASCII to EBCDIC, using BSD-compatible conversions. Solaris only.

ibm

ASCII to EBCDIC with IBM conventions.

ibmb

ASCII to EBCDIC with IBM conventions, using BSD-compatible conversions. Solaris only.

block

Variable-length records (i.e., those terminated by a newline) to fixed-length records.

unblock

Fixed-length records to variable-length.

lcase

Uppercase to lowercase.

ucase

Lowercase to uppercase.

noerror

Continue processing when errors occur (up to five in a row).

notrunc

Do not truncate the output file. This preserves blocks in the output file that this invocation of dd did not write. Solaris only.

swab

Swap all pairs of bytes.

sync

Pad input blocks to ibs .

count =n

Copy only n input blocks.

files =n

Copy n input files (e.g., from magnetic tape), then quit.

ibs =n

Set input block size to n bytes (default is 512).

if =file

Read input from file (default is standard input).

obs =n

Set output block size to n bytes (default is 512).

of =file

Write output to file (default is standard output).

iseek =n

Seek n blocks from start of input file (like skip but more efficient for disk file input).

oseek =n

Seek n blocks from start of output file.

seek =n

Same as oseek (retained for compatibility).

skip =n

Skip n input blocks; useful with magnetic tape.

You can multiply size values (n ) by a factor of 1024, 512, or 2 by appending the letters k , b , or w , respectively. You can use the letter x as a multiplication operator between two numbers.

Examples

Convert an input file to all lowercase:

dd if=caps_file of=small_file conv=lcase

Retrieve variable-length data; write it as fixed-length to out :

data_retrieval_cmd
 | dd of=out conv=sync,block


Previous: Reference: dc UNIX in a Nutshell: System V Edition Next: Reference: delta
Reference: dc Book Index Reference: delta

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System