Detailed command under linux dd

Detailed command under linux dd

   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: copy the specified input file to the specified output file, and can copy the format conversion process. 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
_____________________________________
dd 是 Linux/UNIX 下的一个非常有用的命令,作用是用指定大小的块拷贝一个文件,并在拷贝的同时进行指定的转换。

dd 的主要选项:
指定数字的地方若以下列字符结尾乘以相应的数字:
b=512, c=1, k=1024, w=2, xm=number m

if=file
输入文件名,缺省为标准输入。

of=file
输出文件名,缺省为标准输出。

ibs=bytes
一次读入 bytes 个字节(即一个块大小为 bytes 个字节)。

obs=bytes
一次写 bytes 个字节(即一个块大小为 bytes 个字节)。

bs=bytes
同时设置读写块的大小为 bytes ,可代替 ibs 和 obs 。

cbs=bytes
一次转换 bytes 个字节,即转换缓冲区大小。

skip=blocks
从输入文件开头跳过 blocks 个块后再开始复制。

seek=blocks
从输出文件开头跳过 blocks 个块后再开始复制。(通常只有当输出文件是磁盘或磁带时才有效)

count=blocks
仅拷贝 blocks 个块,块大小等于 ibs 指定的字节数。

conv=conversion[,conversion...]
用指定的参数转换文件。

转换参数:

ascii 转换 EBCDIC 为 ASCII。

ebcdic 转换 ASCII 为 EBCDIC。

ibm 转换 ASCII 为 alternate EBCDIC.

block 把每一行转换为长度为 cbs 的记录,不足部分用空格填充。

unblock
使每一行的长度都为 cbs ,不足部分用空格填充。

lcase 把大写字符转换为小写字符。

ucase 把小写字符转换为大写字符。

swab 交换输入的每对字节。 Unlike the
Unix dd, this works when an odd number of
bytes are read. If the input file contains
an odd number of bytes, the last byte is
simply copied (since there is nothing to
swap it with).

noerror
出错时不停止。

notrunc
不截短输出文件。

sync 把每个输入块填充到ibs个字节,不足部分用空(NUL)字符补齐。

由于 dd 命令允许二进制方式读写,所以特别适合在原始物理设备上进行输入/输出。例如可以用下面的命令为软盘建立镜像文件:
dd if=/dev/fd0 of=disk.img bs=1440k
有趣的是,这个镜像文件能被 HD-Copy ,Winimage 等工具软件读出。再如把第一个硬盘的前 512 个字节存为一个文件:
dd if=/dev/hda of=disk.mbr bs=512 count=1

转载于:https://www.cnblogs.com/licheng/archive/2008/03/21/1116492.html

Guess you like

Origin blog.csdn.net/weixin_34072857/article/details/92631174