Besides the explanations from the man
pages and --help
information, in which way do the commands dd
, cp
and rsync
differ when used to copy files? In which context is each of these superior to the others, for some definition of 'superior', so that it should get preference of use?

- 1,119
-
2Although I agree that the question is extremely broad and doesn't show that the man pages were actually read, the answer received seems to address it fairly well. For this reason, I think it should not be closed. – Julie Pelletier Jan 21 '17 at 03:02
-
Thanks for this comment. I have read the --help and man pages but I don't see an advantage in 'showing' that I have done it. The purpose of the question is indeed to eschew the technical jargon and have guidance around it. Which jargon may be daunting confusing to the novice. We have received a pretty thorough and to-the-point answer. – XavierStuvw Jan 21 '17 at 08:55
1 Answers
They are completely different animals that better fit on different file or device manipulation cases:
dd
This command was created as a "copy and convert" utility, originally intended for converting files between the ASCII, little-endian, byte-stream world of DEC computers and the EBCDIC, big-endian, appearing at the first time on Unix Version 5. It became the de facto command utility to manipulate everything that can be mapped as a file inside your Unix-like operating system(clone a disc, backup of mbr, clone a disk as file, copy some blocks of one device file, write an image to a usb stick..), and piped to other commands, the sky is the limit. One alternative to this software is the dcfldd
command.
dd related stuff:
- Is there a way to determine the optimal value for the bs parameter to dd?
- 11 Awesome DD Commands
- 6 Examples to Backup Linux Using dd Command (Including Disk to Disk)
- What does dd stand for? - Could be "Dataset Definition" or "Copy and Convert" and was renamed to
dd
only becausecc
was reserved for the C compiler. It is up to choose one of the naming theory ;)
cp
Make copy of files and directories. This is a more "higher" level of abstraction, where you can copy directories recursively, without caring about block size, file conversion, etc. It is a better tool to deal with "1-to-many" cases of file copy, ownership, symbolic link follow, recursively copy, and verbosity. However, it has it's limitations like dealing with file changes, remote copy, and those things better handled by rsync
.
cp related stuff:
- Is it possible to see cp speed and percent copied? - Specific case there
rsync
is a better tool to local copy files ;) - Difference Between cp -r and cp -R (copy command)
rsync
Can to copy files inside the same computer, but it's features are more useful on remote copy scenarios. Some of the features are ownership handling/manipulation, more easy "exclude" expressions for a better copy, file checksum to see if a file was already copied, delete origin files during or after copu, the use of a "transparent shell" by invoking the protocol wanted using a specific URI(ssh://
, rsync://
...), pipelining and other stuff that create optimized environment for remote mirroring things.
rsync related stuff:
- rsync all files of remote machine over SSH without root user?
- Rsync filter: copying one pattern only
- Rsync - 10 Practical Examples
- How to Backup Linux? 15 rsync Command Examples
Further Reading:
-
5
-
I read somewhere "block transfer vs file transfer". Probably dd is the former while cp and rsync are both the latter. That refers to what it is doing under the hood, but possibly that also affects its performance in some way would be interesting to know. – cardamom Feb 07 '22 at 10:58