Linux-dd command details

Source: Internet
Author: User

Linux-dd command details

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.

Name: dd
Permission: all user dd commands in manual are defined as convert and copy a file.

Usage:
Dd [Option]

If you want to view Manual Online, try:
Dd -- Help

Or
Info dd

If you want to see how this version is:
Dd -- version

Input or output
Dd If = [stdin] of = [stdout]

The number of bytes of the input or output size.
BS: dd-IBS = [byte]-obs = [size]

How many bytes are allowed at a time?
CBS = bytes

Output only after skipping a paragraph
Seek = Blocks

Skip a section before entering
Skip = Blocks

Of course, you can use this to conveniently copy the CD. (Note that your CD is in the standard iso9660 format !)

Dd If =/dev/CDROM of = CDROM. ISO
The content after if and after if is adjusted according to your requirements.

Then run the following command on the system:

Cdrecord-v cdrom. ISO
This article is not about cdrecord, so the above commands are the simplest but may not necessarily meet your hardware environment...
Function: Copies the specified input file to the specified output file, and supports format conversion during the copy process. You can use this command to implement the diskcopy command in DOS. Use the DD command to write the data on the floppy disk as a storage file on the hard disk, and then write the storage file to the second disk to complete the diskcopy function. Note that you should delete the storage file on the hard disk with the RM command. Standard input files and standard output files are used by default.

Syntax: dd [Option]

If = input file (or device name ).

Of = output file (or device name ).

IBS = Bytes: the number of bytes read from the buffer zone.

Skip = blocks skip the IBS * blocks block at the beginning of the read buffer.

Obs = Bytes: the number of bytes written to the buffer zone.

BS = Bytes: set the number of bytes in the read/write buffer at the same time (equal to setting IBS and OBS ).

CBS = byte: bytes are converted once.

Count = blocks only copies the input blocks block.

Conv = ASCII converts the ebcdic code to the ascil code.

Conv = ebcdic converts an ascil code to an ebcdic code.

Conv = IBM converts an ascil code to an alternate ebcdic code.

Conv = block converts a variable bit to a fixed character.

Conv = ublock converts a fixed bit to a variable bit.

Conv = ucase converts lowercase letters to uppercase letters.

Conv = lcase converts uppercase letters to lowercase letters.

Conv = notrunc: the output file is not truncated.

Conv = swab exchange each pair of input bytes.

Conv = do not stop processing when noerror occurs.

Conv = Sync adjusts the size of each input record to the IBS size (filled with NUL ).

 

Example 1: copy the content of a floppy disk to another floppy disk and use/tmp as the temporary storage area. Insert the source disk into the drive and enter the following command:

$ Dd If =/dev/fd0 of =/tmp/tmpfile

After the copy is complete, extract the source disk from the drive and insert the target disk. Enter the following command:

$ Dd If =/tmp/tmpfile of =/dev/fd0

After the floppy disk is copied, delete the temporary file:

$ RM/tmp/tmpfile

 

Example 2: Write the net. I file to a floppy disk and set the number of read/write buffers.

(Note: The content in the floppy disk will be completely overwritten)

$ Dd If = net. I of =/dev/fd0 BS = 16384

 

Example 3: copy the sfile to the dfile.

$ Dd If = sfile of = dfile

 

Example 4: Create a m empty file

Dd If =/dev/Zero of=hello.txt BS = 100 m COUNT = 1

========================================================== =====

/Dev/null. The nickname is a bottomless pit. You can output any data to it. It can be used without support!
/Dev/zero is an input device. You can use it to initialize files.

/Dev/null ------ it is an empty device, also known as a bit bucket ). Any output written to it will be discarded. If you do not want to display messages in standard output or write files, you can redirect messages to the bucket.
/Dev/Zero ------ the device provides 0 infinitely, and you can use any number you need-the device provides more. It can be used to write string 0 to a device or file.
$ Dd If =/dev/Zero of =./test.txt BS = 1 k count = 1
$ LS-l
Total 4
-RW-r -- 1 Oracle DBA 1024 Jul 15 test.txt

 

Eg:

$ Find/-name access_log 2>/dev/null

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.