DD is a very useful command under Linux/unix, which is to copy a file with a block of the specified size and make the specified conversion at the same time as the copy.
Name: DD
Usage rights: All user dd This directive is defined in manual as convert and copy a file
How to use:
DD [option]
If you want to see 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]
The size of the forced input or output is how many bytes
DD -ibs=[byte]-obs=[size]
Forcing only a few Bytes at a time.
Cbs=bytes
Skipping over a period before outputting
Seek=blocks
Skip a paragraph before entering
Skip=blocks
Of course you can use this to facilitate the copy of the disc (note that your CD-ROM is the standard iso9660 format to do so yo!) )
DD if=/dev/cdrom of=cdrom.iso
The contents of the if and after are adjusted according to your needs.
Then give the system this command to burn:
Cdrecord-v Cdrom.iso
This is not about Cdrecord, so the instructions above are the simplest but not necessarily compatible with your hardware environment ...
Function: Copies the specified input file into the specified output file, and can be converted in format during the copy process. You can use this command to implement the diskcopy command under DOS. First use the DD command to write the data on the floppy disk to a storage file, and then the storage file written to the second floppy disk, complete the function of diskcopy. It should be noted that the storage file on the hard disk should be removed with the RM command. The system uses standard input files and standard output files by default.
- Syntax: DD [Options]
- if = input file (or device name).
- of = output file (or device name).
- IBS = Bytes Reads bytes bytes At a time, that is, the number of bytes read into the buffer.
- Skip = Blocks skips the ibs*blocks block that reads into the beginning of the buffer.
- Obs = bytes Writes bytes bytes At a time, that is, the number of bytes written to the buffer.
- BS = bytes Sets the number of bytes in the read/write buffer (equal to the set IBS and OBS).
- CBS = Byte converts bytes bytes at a time.
- The count=blocks only copies the input blocks blocks.
- CONV = ASCII Converts the EBCDIC code to Ascil code.
- Conv = EBCDIC converts ascil code to EBCDIC code.
- CONV = IBM converts ascil code to alternate EBCDIC code.
- CONV = Block Converts the change bit to a fixed character.
- CONV = Ublock Converts the fixed bit into a change bit.
- CONV = UCase Converts the letter from lowercase to uppercase.
- CONV = LCase converts letters from uppercase to lowercase.
- CONV = Notrunc does not truncate the output file.
- CONV = swab swaps each pair of input bytes.
- CONV = NoError does not stop processing when an error occurs.
- Conv = sync puts the size of each input record to the size of the IBS (filled with nul).
Example 1: To copy the contents of one floppy disk to another floppy disk, 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, remove the source disk from the drive, insert the target disk, and enter the command:
DD if =/tmp/tmpfile of =/dev/fd0
After the floppy copy is complete, the temporary files should be deleted:
RM /tmp/tmpfile
Example 2: Write the net.i file to a floppy disk and set the number of read/write buffers.
(Note: The contents of the floppy disk will be completely overwritten)
DD if 16384
Example 3: Copy the file sfile to the file Dfile.
DD if=sfile of=dfile
Example 4: Creating an empty 100M file
DD if=/dev/zero of=hello.txt bs=100m count=1
- ============================================
- /dev/null, nicknamed the Bottomless pit, you can output any data to it, it take all, and will not hold!
- /dev/zero, is an input device that you can use to initialize files.
- /dev/null--It is an empty device, also known as a bit bucket (bits bucket). Any output written to it will be discarded. If you do not want the message to display or write to the file in standard output, you can redirect the message to the bin.
- /dev/zero--The device provides an exhaustive 0, you can use any number you need-the device provides much more. He can be used to write a string 0 to a device or file.
DD if=/dev/zero of=./test.txt bs=1k count=1ls -41 1024x768: Test.txt
eg
Find 2>/dev/null
The simplest way to create a specific size file is to use the DD command.
DD If= "InputFileName" of= "Outfilename" bs= "Block Size" count= "Number of blocks"
Block size can be used in various units of measurement
Byte (1B) –c Word (2B) –w
Block (512B) –b kilobytes (1024B) –k
Megabyte (1024K) –m gigabyte (1024M) –g
Cases:
DD if=/dev/zero of=test. file bs=1m count=
Create a file of size 10M under the current folder Test.file content is all 0
/dev/zero is a character device that continually returns a value of 0 bytes (/0).
If you do not specify an input parameter (if), the input is read from stdin by default. If you do not specify an output parameter (of), stdout is used as the output by default.
You can also use the DD command to transfer large amounts of data to test memory operation speed.
$ dd if =/dev/zero Of=./testmm.file bs=10m count=10 +0 The read-in records the +0 105 MB) has been copied, 0.577581 seconds, 182 mb/ seconds $ ll -H | grep ' TESTMM. file "-rw-rw-r–. 1 itudu itudu 100M July 16 18 : 14 testmm. file
File type: the
General Documents: –
Catalog file: D
Character Device: C
Block Device: b
Link file: L
Socket file: S
Pipe file: P
Read, write, and execute permission meanings for a directory:
Read permissions: Allows you to read a list of files and subdirectories in a directory
Write permissions: Allow new and deleted files or subdirectories in the directory
Execute permissions: Access to files and subdirectories in the directory
LINUX-DD command Explanation