|
|
Log in / Subscribe / Register

Deprecating scp

Deprecating scp

Posted Nov 6, 2020 6:49 UTC (Fri) by marcH (subscriber, #57642)
In reply to: Deprecating scp by nilsmeyer
Parent article: Deprecating scp

It is true that rsync can do everything but the kitchen sink but in practice there are only two rsync things you need to remember:

- Use -a ("archive") always.
- The infamous source trailing slash: on the source side, foo/ is equivalent to foo/*, including dot files

And that's it, I never remember anything else. Plus who reads man pages from top to bottom? I have no idea how long most man pages are because I only search them.

I dropped not just scp for rsync but I also dropped cp -R because if you run "cp -R dir/ brandnewdir/" multiple times then it is not idempotent, it does something different the first time. Crazy!

Except on macOS (and BSDs?) where "cp -R dir/ brandnewdir/" is idempotent.

But wait, on macOS "cp -R dir brandnewdir/" (no trailing slash on the source dir) is again not idempotent!

Imagine you're copying something very big and the first time gets interrupted for some reason. Now you are _really_ screwed if you run it again and the second time does something different...

tl;dr: cp -R is insane, use rsync -a. Using it more than once is not just safer it's also much faster of course: it can be used as an actual backup tool.


The LWN site is currently under high scraper load, so comment display has been suppressed for anonymous users. If you are a human, you may read the comments by clicking the button below:

Note: you can avoid this step in the future by logging into your LWN account.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds