Explanation of dd commands in linux
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
_____________________________________
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
Unix dd, this works when an odd number
Bytes are read. If the input file contains
An odd number of bytes, the last byte is
Simply copied (since there is nothing
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