Linux-dd command Detailed

Detailed command Linux-dd 

dd is a very useful under Linux / UNIX command, is to copy a file with the specified block size, and the designated conversion simultaneous copies.

Name: dd 
Access: All users dd command is defined in this manual in a convert and copy a file 

use: 
dd [the Option] 


if you want to see the manual online, you can try: 
dd --help 

or 
info dd 

If you want to see how this version: 
dd --version 

input or output 
dd IF = [STDIN] of = [STDOUT] 

Size forced input or output for the number of Bytes 
bs: dd-IBS = [BYTE]-OBS = [ SIZE] 

forced to do only the number of Bytes 
cbs = BYTES 

only output after skipping a period of 
seek = BLOCKS 

only after a period of input skip 
skip = BLOCKS 

of course, you can take this to easily copy a disc (note that your CD-ROM is standard iso9660 format before they can do it yo!) 

dd if = / dev / cdrom of = cdrom.iso 
which later if and adjusted according to the needs of your back content. 

Then give the command system can burn: 

cdrecord -v cdrom.iso 
This is not talking about cdrecord, so the above command is the simplest but not necessarily in line with your hardware environment ...
Function: to copy the specified input file to the specified output file, and copy format conversion process may be performed. You can use the command role diskcopy command under DOS implementation. First with dd command to write data on the disk of a hard disk storage file, and then write the second register file on the floppy disk, complete diskcopy function. It should be noted that the register file on the hard disk will be removed with the rm command. The system uses standard input file and standard output file by default. 

Syntax: dd [Option] 

IF = input file (or device name). 

of = output file (or device name). 

ibs = bytes bytes bytes once read, i.e. the number of bytes read into the buffer. 

skip skip = blocks read into the beginning of the buffer ibs * blocks block. 

obs = bytes bytes bytes of the write-once, i.e., the number of bytes written to the buffer. 

bs = bytes and set the read / write byte buffer (equal to the set ibs and obs). 

cbs = byte bytes bytes conversion. 

count = blocks copy only blocks block input. 

conv = ASCII code is converted ASCIl EBCDIC code. 

conv = ebcdic converting ASCIl in EBCDIC code. 

conv = ibm to ASCIl code is converted to alternate EBCDIC code. 

conv = block converts the variation to a fixed bit characters. 

conv = ublock converted into a fixed bit position changes. 

conv = ucase the lowercase to uppercase letters. 

conv = lcase converted to uppercase to lowercase letters. 

conv = notrunc not truncate the output file. 

conv = swab switching each pair of input bytes. 

conv = noerror error processing is not stopped. 

conv = sync the size of each input record are transferred to the size of ibs (filled with NUL). 

  

Example 1: content should be copied to a floppy disk on another disk using / tmp as a temporary storage area. The source disk into the drive, enter the following command: 

$ dd IF = / dev / fd0 of = / tmp / tmpfile 

After copying the source disk removed from the drive, the target disk is inserted, enter the command: 

$ dd IF = / tmp / tmpfile of = / dev  / fd0

floppy disk copy is complete, you should delete temporary files: 

$ RM / tmp / tmpfile 

  

Example 2: the net.i this file is written to a floppy disk, and set read / write buffer number. 

(Note: the contents of the floppy disk will be completely overwritten) 

$ dd net.i of IF = = / dev / fd0 BS = 16384 

  

Example 3: sfile copied to the file in the file dfile. 

$ Dd if = sfile of = dfile

 

Example 4: Create an empty file of a 100M

dd if=/dev/zero of=hello.txt bs=100M count=1

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

/ dev / null, nicknamed bottomless pit, you can output any data to it, it takes all, and will not propped!
/ dev / zero, is an input device, you can use it to your initialization file.


/ dev / null ------ is an empty device, also called a bit bucket (bit bucket). Any write its output will be abandoned. If you do not want to display a message or write the file to standard output, you can redirect messages barrels in place.
/ dev / zero ------ endlessly to provide the device 0, you can use any number you need - and more and more devices to be provided. He can be 0 for writing a string to the device or file.
Dd = IF $ / dev / ZERO of = / = test.txt BS COUNT = 1K. 1.
$ LS -l
Total. 4
-rw-R & lt - r--. 1 Oracle DBA 1024 Jul-15 16:56 test.txt

 

eg:

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

Guess you like

Origin www.cnblogs.com/chengkanghua/p/11089608.html