How to use dd command in Linux system

  
                

The dd command is very useful on Linux systems, Linux commands that can copy files. And the dd command can also copy the file while copying the file. This article will analyze the simple description of the Linux system dd command.

dd command

Function: copy the specified input file to the specified output file, and can copy the format conversion 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 as a registered file on the hard disk, and then write the registered file to the second floppy disk to complete the diskcopy function. It should be noted that the registered file on the hard disk should be deleted 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 Read bytes bytes at a time, that is, the number of bytes read into the buffer.

skip = blocks Skips the ibs*blocks block at the beginning of the buffer.

obs = bytes Write bytes bytes at a time, that is, the number of bytes written to the buffer.

bs = bytes Set the number of bytes in the read/write buffer (equal to setting ibs and obs).

cbs = byte Convert bytes bytes at a time.

count=blocks Only copy the input blocks.

conv = ASCII Converts EBCDIC codes to ASCIl codes.

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 change bit to a fixed character.

conv = ublock converts a fixed bit into a variable bit.

conv = ucase Converts letters from lowercase to uppercase.

conv = lcase Converts letters from uppercase to lowercase.

conv = notrunc Does not truncate the output file.

conv = swab exchanges each pair of input bytes.

conv = noerror Does not stop processing when an error occurs.

conv = sync The size of each input record is adjusted to the size of ibs (filled with NUL).

Example 1: To copy the contents of a floppy disk to another floppy disk, use /tmp as a 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 file 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 = net.i of = /dev/fd0 bs = 16384

Example 3: Copy the file sfile to the file dfile.

$ dd if=sfile of=dfile

The above is a brief description of the Linux system dd command. Through the introduction of the dd command and several examples, I believe that everyone can The dd command has a preliminary understanding.

Copyright © Windows knowledge All Rights Reserved