Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there a reason to use scp instead of rsync? I can see no reason for using scp ever again, rsync does everything that scp does, with more safety (can preserve symlinks etc).

share|improve this question
5  
Short answer: No. scp is never harmful. –  Shadur May 31 '12 at 9:01
    
@Shadur scp is harmful in that it overwrites existing target files by default. So's rsync, but it at least allows limiting the possible damage with -u. –  Gilles May 31 '12 at 22:46
    
@Gilles As with any tool, you must understand what it does and how it does it to use it safely. –  Alex Chamberlain Jun 1 '12 at 7:24
2  
In that context, regular cp and rm would be considered "harmful" -- and if you define "harmful" as "can screw me over if I do something stupid", rsync isn't any less harmful. –  Shadur Jun 1 '12 at 9:31
    
scp -a will not work, and will be slower. I see no reason to use it, if you have something else at hand. rsync is less harmfull in the sense that it can at least preserve symlinks, so can cp. –  mikebloch Jun 10 '12 at 12:09

4 Answers 4

up vote 3 down vote accepted

If you have to copy a large number of files, or have large files, rsync over ssh will be much faster than scp.

share|improve this answer
1  
rsync speeds up copies when the destination already has an older copy of the file(s) by sending only the changed parts, otherwise it is not faster than scp. –  psusi May 31 '12 at 22:19
2  
You can try it out yourself, or take someone elses word for it: digitalsanctuary.com/tech-blog/debian/… . Try scp vs rsync of your /usr/bin/ dir for example. –  Not Now May 31 '12 at 22:43
    
@psusi Rsync does have less per-file overhead than scp from OpenSSH, so it's faster when copying many small files, even for a brand-new copy. –  Gilles May 31 '12 at 22:48
1  
It looks like scp does have a problem with large numbers of small files. With a single large file though, both can easily saturate a 100 mbps lan. –  psusi Jun 1 '12 at 14:32
1  
Interesting. rsync should have more overhead, since it needs to check in advance if the target(s) exists. –  Nils Jun 10 '12 at 20:56

One of the main things (which I think no one mentioned) is that if you are transferring large amounts of data or files, and if the transfer is disconnected before completion for any reason, rsync will pick it up where it left off. Whereas scp doesn't.

I use scp if I want to transfer one or couple of files or directories. I go to rsync for multi GB size data.

share|improve this answer
    
Might be worth adding that the --partial flag is useful when transferring large files. rsync will pick up where it left off within the file rather than starting that file again. –  Flup Jul 26 '13 at 15:28

scp is simpler to use as it takes less arguments. I catch myselv using scp instead of rsync if I only transfer a single file. Propably I am just to lazy to define an alias to rsync... ;-)

share|improve this answer
1  
Hmmm, why is it so? rsync a host:b is equivalent to scp a host:b, same number of arguments. –  mikebloch Apr 9 '13 at 5:40
1  
@mikebloch Two letters more to type... ;-) In the past I had to supply "-e ssh -a" to get the proper result. Now that "-e ssh" is default this might be a different game. –  Nils Apr 9 '13 at 14:44

scp provides a cp like method to copy files from one machine to a remote machine over a secure SSH connection.

rsync allows you to syncronise remote folders.

They are different programs and both have their uses. scp is always secure, whereas rsync must travel over SSH to be secure.

share|improve this answer
3  
Also, pretty sure rsync has to be installed on the other end. –  ckhan May 31 '12 at 7:59
1  
@ckhan, no it can copy without having anything installed in the other side, it'll just be less efficient. –  mikebloch May 31 '12 at 8:40
    
@Alex so the answer is: "scp ensures that you will always encrypt the data on the wire, rsync doesn't" (the fact that rsync has more features doesn't mean it can't be used as a mere cp) –  mikebloch May 31 '12 at 8:41
1  
@mikebloch How do you do that? Is it a new feature? Just tried this using version 3.0.9. and it complained it couldn't find rsync on the remote. –  Alexios May 31 '12 at 10:00
1  
@mikebloch, it has to be installed on the server to do the checksum computations, which can add a lot of cpu load to the server. This is why most large sites don't support it, and why zsync was created as an alternative. –  psusi May 31 '12 at 22:17

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.