dd (Unix)

Dd is a Unix command that is used to copy and cropping of data streams.


The dd program is designed to redirect data streams.

Dd extends the functionality of cp and cat. While cp works with files and copies them, dd data from data streams can be cut ( for example, starting out at byte position 5000 to read). dd is very often used to copy content from media via device files. However, the use of this type of DD for copying actions practically does not differ from the use of the CP. Both programs use the POSIX function open (), read (), write () and close (). Technically, cp and dd behave in the simple use types thus identical. For example, the line

$ Dd if = / dev / hda of = hda.dump is equivalent to each of the following row ( with the exception that, for the redirection operators devices and files with the shell open )

$ Cp / dev / hda hda.dump $ Dd hda.dump $ Cat hda.dump history

Dd was introduced in the 1970s. The name alludes to the DD statement ( " DD " for English, " data definition " ) in from the Job Control Language. The name was supposed to be on "cc" what should be an abbreviation for "Copy and Convert" the program shortcut was already assigned to the C compiler. Furthermore, older IBM operating systems for mainframe computers had a program called " GDR" ( "Disk Dump and Restore " ), from which the dd command was inspired. It established itself as a standard tool of Unix environments and was often copied. An important implementation is the GNU project that was originally written by Paul Rubin, David MacKenzie, and Stuart Kemp and finds himself in virtually all GNU / Linux distributions. In addition to implementations of the same functional scope there are many customized versions that are honed in on the application for data recovery and forensics. The software Ghost clones and their heirs and built on the concept of dd and extended it.


The syntax for calling dd ​​differs significantly from that of other Unix commands, such as cp. To be expected as an argument to dd (any number ) operand.

Dd [ Operand] ...


When reading from hard drives, the value " 2K" for 2048 bytes is recommended for better performance here.

Measurement of progress and throughput

Often the lack of a progress bar or outputs from dd is criticized. Most implementations of dd give, however when receiving a specific signal ( USR1 in GNU dd or SIGINFO in the implementations under * BSD and Mac OS X) is a status output. By the user program uses the kill, he can accordingly informed about the progress of dd:

262 1 records a 262 1 records out 551077888 bytes ( 551 MB) copied, 173.859 s, 3.2 MB / s

Each receiving the USR1 signal or SIGINFO dd outputs such a status message. The kill program itself is, however, if successful, no spending. Of course, the kill command can be called multiple times, even automated ( for example, repeated $ watch- n N kill- USR1 ` pidof dd ` calling every N seconds. )


Some simple examples to illustrate the functionality. This could likewise be reacted alone with cp, the equivalent command is, therefore, indicated in the second column.

Especially in connection with the widespread adoption of the Unix derivative Linux on the desktop dd is overvalued by inexperienced users often. In addition to tasks that can be implemented as cp, dd is often used in places where stream diversions and pipes would be a much simpler and more elegant solution.

When using the buffered device, the use of dd is superfluous and would have the same effect as the unnecessary use of cat / dev/hda1 | .... By using < and > but can Ein-/Ausgabedateien be redirected directly. This is also resource-efficient because less need to run new processes. For unbuffered devices, however, it must be ensured that each read operation works with Integer multiples of the sector size. Note that gzip uses only one processor. To use a plurality of processors for compression, for example, can be used pigz.

Again, the dd command is unnecessary.

Only for more complex applications of dd shows its real superiority over cp and the stream redirection operators. Some exemplary examples illustrate the flexibility and versatility that results from the combination of dd with stream diversion, which are part of the standard functionality of Unix shells, as well as other traditional Unix commands.

Alternatives and Enhancements

There are some alternatives and extensions of the dd program. The most popular alternatives are:

  • Ddrescue - Advanced functionality for access to damaged media ( does not break the copy operation )
  • Dcfldd - with enhanced output and uses the same syntax as dd
  • Dc3dd - with status bar of the process and expanded edition