Easy Tutorial
❮ Linux Comm Lprm Linux Comm Groupdel ❯

Linux dd Command

Linux Command Manual

The Linux dd command is used to read, convert, and output data.

dd can read data from standard input or files, convert the data according to specified formats, and then output it to files, devices, or standard output.

Parameter Explanation:

Example

To create a bootable disk on Linux, you can use the following command:

dd if=boot.img of=/dev/fd0 bs=1440k

To convert all English letters in the testfile to uppercase and save it as testfile_1, use the following command in the command prompt:

dd if=testfile_2 of=testfile_1 conv=ucase

Where the content of testfile_2 is:

$ cat testfile_2 # Contents 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:

$ dd if=testfile_2 of=testfile_1 conv=ucase # Using the dd command, uppercase conversion recorded 0+1 reads
0+1 writes recorded
95 bytes (95 B) copied, 0.000131446 seconds, 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 are converted to uppercase

To read a string from the standard input device, convert it to uppercase, and output it to the standard output device, use the command:

dd conv=ucase

After entering the command and pressing Enter, input the string, press Enter again, and then press Ctrl+D to exit, resulting in:

$ dd conv=ucase
Hello Linux! # Input the string and press Enter
HELLO LINUX! # Press Ctrl+D to exit, uppercase conversion result
0+1 reads recorded
0+1 writes recorded
13 bytes (13 B) copied, 12.1558 seconds, 0.0 KB/s

Linux Command Manual

❮ Linux Comm Lprm Linux Comm Groupdel ❯