Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The usage of the Linux command dd

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "the usage of Linux command dd". In daily operation, I believe many people have doubts about the usage of Linux command dd. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "the usage of Linux command dd"! Next, please follow the editor to study!

Dd is a very useful command under Linux/UNIX, which is used to copy a file with a block of the specified size and perform the specified conversion at the same time.

The main options for dd:

If the place of the specified number ends with the following characters multiplied by the corresponding number:

Baked 512, cased 1, kappa 1024, walled 2, xm=number m

If=file

Enter the file name, which defaults to standard input.

Of=file

Output file name, which defaults to standard output.

Ibs=bytes

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

Obs=bytes

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

Bs=bytes

At the same time, the size of the read and write block is set to bytes, which can replace ibs and obs.

Cbs=bytes

Convert bytes bytes at a time, that is, convert the buffer size.

Skip=blocks

Skip blocks blocks from the beginning of the input file before you start copying.

Seek=blocks

Skip blocks blocks from the beginning of the output file before you start copying. (usually valid only if the output file is a disk or tape)

Count=blocks

Only blocks blocks are copied, and the block size is equal to the number of bytes specified by ibs.

Conv=conversion [, conversion...]

Converts the file with the specified parameters.

Conversion parameters:

Ascii converts EBCDIC to ASCII.

Ebcdic converts ASCII to EBCDIC.

Ibm converts ASCII to alternate EBCDIC.

Block converts each line to a record of length cbs, with gaps filled in.

Unblock

Make the length of each line cbs, and fill the insufficient parts with blanks.

Lcase converts uppercase characters to lowercase characters.

Ucase converts lowercase characters to uppercase characters.

Swab swaps each pair of bytes entered. Unlike the

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

Noerror

Don't stop when something goes wrong.

Notrunc

The output file is not truncated.

Sync fills each input block into ibs bytes, and the deficiency is filled with NUL characters.

Because the dd command allows binary reading and writing, it is particularly suitable for input / output on raw physical devices. 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=1440k

Interestingly, this image file can be read by HD-Copy, Winimage and other tools. 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

At this point, the study of "the usage of the Linux command dd" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report