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


UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: Reference: dc Chapter 2
UNIX Commands
Next: Reference: delta
 

dd



dd

 [

option



=



value

]

Make a copy of an input file ( if= ) 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 , ebcdic , ibm , block , or unblock .

conv= flags

Convert the input according to one or more (comma-separated) flags listed below. The first five flags are mutually exclusive.

ascii

EBCDIC to ASCII.

ebcdic

ASCII to EBCDIC.

ibm

ASCII to EBCDIC with IBM conventions.

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 5 in a row).

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 letter 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 Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System