YouTip LogoYouTip

Linux Comm Dd

# Linux dd Command [![Image 3: Linux Command Manual](#) Linux Command Manual](#) The Linux `dd` command is used to read, convert, and output data. `dd` can read data from standard input or a file, convert the data according to a specified format, and then output it to a file, device, or standard output. **Parameter Description:** * `if=file`: Input filename, default is standard input. Specifies the source file. * `of=file`: Output filename, default is standard output. Specifies the destination file. * `ibs=bytes`: Read `bytes` bytes at a time, i.e., specify a block size of `bytes` bytes. * `obs=bytes`: Write `bytes` bytes at a time, i.e., specify a block size of `bytes` bytes. * `bs=bytes`: Set both read/write block size to `bytes` bytes. * `cbs=bytes`: Convert `bytes` bytes at a time, i.e., specify the conversion buffer size. * `skip=blocks`: Skip `blocks` blocks from the beginning of the input file before starting to copy. * `seek=blocks`: Skip `blocks` blocks from the beginning of the output file before starting to copy. * `count=blocks`: Copy only `blocks` blocks, where the block size equals the number of bytes specified by `ibs`. * `conv=`, where keywords can be any of the following 11: * `conversion`: Convert the file using specified parameters. * `ascii`: Convert from EBCDIC to ASCII. * `ebcdic`: Convert from ASCII to EBCDIC. * `ibm`: Convert from ASCII to alternate EBCDIC. * `block`: Convert each line to a length of `cbs`, padding with spaces if insufficient. * `unblock`: Pad each line to a length of `cbs` with spaces. * `lcase`: Convert uppercase characters to lowercase. * `ucase`: Convert lowercase characters to uppercase. * `swap`: Swap every pair of input bytes. * `noerror`: Do not stop on errors. * `notrunc`: Do not truncate the output file. * `sync`: Pad each input block to `ibs` bytes with NUL characters if insufficient. * `--help`: Display help information. * `--version`: Display version information. ### Examples To create a bootable disk under Linux, you can use the following command: ```bash dd if=boot.img of=/dev/fd0 bs=1440k To convert all English letters in the file `testfile` to uppercase and output to `testfile_1`, use the following command at the command prompt: ```bash dd if=testfile_2 of=testfile_1 conv=ucase The content of `testfile_2` is: ```bash $ cat testfile_2 #Content of testfile_2 HELLO LINUX! Linux is a free unix-type opterating system. This is a linux testfile! Linux test After conversion, the content of `testfile_1` is as follows: ```bash $ dd if=testfile_2 of=testfile_1 conv=ucase #Use dd command for case conversion 0+1 records in 0+1 records out 95 bytes (95 B) copied, 0.000131446 s, 723 kB/s cmd@hdd-desktop:~$ cat testfile_1 #View the converted content of testfile_1 HELLO LINUX! LINUX IS A FREE UNIX-TYPE OPTERATING SYSTEM. THIS IS A LINUX TESTFILE! LINUX TEST #All characters in testfile_2 have become uppercase To read a string from the standard input device, convert it to uppercase, and then output it to the standard output device, use the following command: ```bash dd conv=ucase After entering the above command and pressing Enter, type a string, press Enter again, then press the key combination `Ctrl+D` to exit. The following result will appear: ```bash $ dd conv=ucase Hello Linux! #Type the string and press Enter HELLO LINUX! #Press Ctrl+D to exit, showing the uppercase result 0+1 records in 0+1 records out 13 bytes (13 B) copied, 12.1558 s, 0.0 kB/s [![Image 4: Linux Command Manual](#) Linux Command Manual](#) [](#)(#) (#)[](#)
← Linux Comm Ext2EdLinux Comm Cfdisk β†’