Difference between scp and rsync?

11,752

1) Performance

scp will be faster

2) Security

scp is more secure, but if you were to use rsync -avz -e ssh, then rsync would be as secure

3) Capability

rsync can 'sync' the two copies, so lets say if your scp stopped in middle of the transfer for some reason (network issue lets say), you could use rsync to complete the transfer. scp will simply overwrite.

alias scpresume="rsync --partial --progress --rsh=ssh"

rsync can also exclude certain subdirectories/files using the --exclude flag, scp can't do that.

Share:
11,752

Related videos on Youtube

pnongrata
Author by

pnongrata

Updated on September 18, 2022

Comments

  • pnongrata
    pnongrata almost 2 years

    Title pretty much says it all. If I have a folder (mydir/) on server1.com, and want to copy it to a parent folder on server2.com, then what is the difference (performance, security, capabilities, etc.) between:

    scp mydir/ server2.com:/some/path/

    and...

    rsync -avz mydir/ [email protected]:/some/path/

    Thanks in advance!

    • Wayne Jhukie
      Wayne Jhukie over 12 years
      If this isn't a duplicate of something, it's a valid question
  • pnongrata
    pnongrata over 12 years
    Thanks freethinker - what is it that makes scp more secure? SSH? If so, is that why setting rsync's rsh argument to ssh accomplishes the same thing?
  • user5249203
    user5249203 over 12 years
    If you repeat the copy, rsync may be faster as it only transfers differences in files. This is it's raison d'être.
  • me_and
    me_and almost 10 years
    AIUI rsync now uses SSH by default, so there's no difference in security. And all the other reports I've seen say rsync will be at least as fast as scp; why do you think scp is quicker?
  • Luke Stanley
    Luke Stanley almost 7 years
    So basically most of this answer is out of date or now incorrect?