首页

dd

dd
功能说明:读取,转换并输出数据。
语  法:dd [bs=<字节数>][cbs=<字节数>][conv=<关键字>][count=<区块数>][ibs=<字节数>][if=<文件>][obs=<字节数>][of=<文件>][seek=<区块数>][skip=<区块数>][--help][--version]
补充说明:dd可从标准输入或文件读取数据,依指定的格式来转换数据,再输出到文件,设备或标准输出。
参  数:
  bs=<字节数>   将ibs( 输入)与obs(输出)设成指定的字节数。
  cbs=<字节数>   转换时,每次只转换指定的字节数。
  conv=<关键字>   指定文件转换的方式。
  count=<区块数>   仅读取指定的区块数。
  ibs=<字节数>   每次读取的字节数。
  if=<文件>   从文件读取。
  obs=<字节数>   每次输出的字节数。
  of=<文件>   输出到文件。
  seek=<区块数>   一开始输出时,跳过指定的区块数。
  skip=<区块数>   一开始读取时,跳过指定的区块数。
  --help   帮助。
  --version   显示版本信息。

dd

dd options

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 overrides 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 next. 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 records.

lcase

Uppercase to lowercase.

ucase

Lowercase to uppercase.

noerror

Continue processing after read errors.

notrunc

Don't truncate output file.

swab

Swap each pair of input bytes.

sync

Pad input blocks to ibs with trailing zeros.

count=n

Copy only n input blocks.

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).

seek=n

Skip n output-sized blocks from start of output file.

skip=n

Skip n input-sized blocks from start of input file.

--help

Print help message and then exit.

--version

Print the version number and then exit.

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 and write it as fixed-length to out:

[data_retrieval_cmd] | dd of=out conv=sync,block