Introduction to Linux/Unix Command dd

Source: Internet
Author: User
Dd is a very useful command in Linux/Unix. It is used to copy an object with a specified size block and perform the specified conversion at the same time.

Main options of DD:

If the following column ends with a specified number, multiply it by the corresponding number:

B = 512, c = 1, K = 1024, W = 2, XM = Number m

If = File

Input File name. The default value is standard input.

Of = File

Output file name. The default value is standard output.

IBS = bytes

Read bytes at a time (that is, the size of a block is bytes ).

Obs = bytes

Write bytes at a time (that is, the size of a block is bytes ).

BS = bytes

Set the size of the read/write block to bytes, which can replace IBS and obs.

CBS = bytes

Bytes are converted at a time, that is, the size of the conversion buffer.

Skip = Blocks

The blocks are skipped from the beginning of the input file and then copied.

Seek = Blocks

The blocks are skipped from the beginning of the output file and then copied. (Usually only valid when the output file is a disk or tape)

Count = Blocks

Copy only blocks. The block size is equal to the number of bytes specified by IBS.

Conv = Conversion [, conversion...]

Use the specified parameter to convert the file.

Conversion parameters:

ASCII conversion ebcdic is ASCII.

Ebcdic converts ASCII to ebcdic.

IBM converts ASCII to alternate ebcdic.

Block converts each row to a record with a length of CBS. The missing part is filled with spaces.

Unblock

Make the length of each line be CBS, and fill the remaining part with spaces.

Lcase converts uppercase to lowercase.

Ucase converts lowercase to uppercase.

Swab exchanges each pair of input bytes. Unlike theunix DD, this works when an odd number of bytes are read. if the input file contains an odd number of bytes, the last byte is simply copied (since there is nothing to swap it ).

Noerror

Do not stop when an error occurs.

Notrunc

The output file is not truncated.

Sync fills each input block into IBS bytes, and the missing part is filled with null (NUL) characters.

Since the DD command allows binary read/write, it is particularly suitable for input/output on the original physical device. For example, you can use the following command to create an image file for a floppy disk:

Dd If =/dev/fd0 of = disk. img bs = 1440 K

Interestingly, this image file can be read by tools such as HD-copy and winimage. Another example is to save the first 512 bytes of the first hard disk as a file:

Dd If =/dev/hda of = disk. mbr bs = 512 COUNT = 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.