Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

For normal file copying in *nix, I've only ever seen people use cp (eg. cp /mnt/mydevice/myfile ~/myfile), but I eventually ran into dd, which appears to do the exact same thing (dd if=/mnt/mydevice/myfile of=~/myfile). I do see that they have some different parameters available (dd seems better at fine-tuned copying), but they appear redundant. Do these tools really do the same thing?

share|improve this question
    
They do the same things only for regular files. Try for example to copy a directory with dd. –  Eddy_Em Jun 18 '13 at 20:03
    
...or a device (like /dev/sda) with cp. –  jpaugh Jun 18 '13 at 21:45
    
Was your question answered? –  Kruug Jun 20 '13 at 20:58

1 Answer 1

up vote 4 down vote accepted

To answer your main question, no, they do not do the same thing.

dd works on the file you specify, making it able to copy data between devices, or from a device to a file. This is commonly used for moving data if devices specifically are involved (create an iso image from a cd-rom disc for example: dd if=/dev/cdrom of=mycdrom.iso), or backup raw devices (sometimes used in RAC databases: dd if=/dev/raw/raw1 of=device_raw1)

cp is used for duplicating file content to a new file or to a new location. things you specifically want there are preservation of ownership, timestamp and mode (rights), and being able to recurse the operation (=being able to copy directories).

Source

share|improve this answer
    
Ah! Okay, so dd copies the raw file, whereas cp copies the contents (which allows it to for instance copy directories without breaking the filesystem). Thanks! –  user232105 Jun 21 '13 at 18:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.