rsync vs scp: Which One Should You Use?
Both copy files over SSH. rsync sends only what changed; scp sends everything, every time.
Side by side
| rsync | scp | |
|---|---|---|
| Transfers only changes | Yes — block-level delta algorithm | No — resends the whole file |
| Resume interrupted transfer | Yes (-P) | No, starts over |
| Directories | Native, with -a preserving everything | Needs -r, loses some metadata |
| Progress display | Yes (-P), including totals | Basic per-file |
| Delete extraneous files | Yes (--delete) for true mirroring | No |
| Dry run | Yes (-n) — preview before acting | No |
| Exclusions | Yes (--exclude, repeatable) | No |
| Installed everywhere by default | Usually, but not guaranteed | Yes, ships with OpenSSH |
| Command length for one file | rsync -av file host:/dst/ | scp file host:/dst/ |
Which one, when
Sending one file to a server, once
Use scp
Shorter to type and there is nothing to optimise: a single file with no previous version at the destination transfers identically either way.
$ scp report.pdf user@server:/tmp/ Deploying a site or app
Use rsync
Only changed assets travel, --delete removes files you deleted locally, and --exclude keeps .git and node_modules out. The second deploy takes seconds instead of minutes.
$ rsync -avz --delete --exclude=".git" build/ user@server:/var/www/app/ Nightly backups
Use rsync
Incremental by nature. After the first run only the differences cross the network, which is what makes daily backups practical at all.
$ rsync -a --delete ~/data/ backup@nas:/backups/data/ Large file over an unreliable connection
Use rsync
With -P it resumes where it stopped. scp starts from zero, which on a 4 GB file and hotel wifi is the difference between finishing and giving up.
$ rsync -avP big.iso user@server:/data/ Copying between two remote servers
Use either, carefully
scp does it in one command but relays through your machine. For anything large, SSH into one server and run rsync from there so the data goes directly.
$ ssh serverA "rsync -avz /data/ user@serverB:/data/" Gotchas worth knowing
- The trailing slash in rsync changes everything: `src/` means "the contents of src", `src` means "the directory itself". This single character causes more rsync surprises than every flag combined.
- Always dry-run a --delete first with -n. Pointed at the wrong destination, --delete faithfully mirrors your source by destroying what is there.
- scp uses capital -P for the port; ssh and rsync use lowercase -p for other things. Everyone burns this once.
- rsync -z compresses in transit: helpful on slow links, wasteful on fast LANs where it just burns CPU.
- Modern OpenSSH reimplemented scp on top of SFTP. The syntax is unchanged, but very old servers may behave differently.
Frequently asked questions
Is rsync faster than scp?
On the first transfer of new data, they are roughly equal — the bytes have to cross either way. On every subsequent run rsync is dramatically faster, because it only sends what changed.
Does rsync need to be installed on both machines?
Yes, on both ends. That is the one practical advantage scp keeps: it works anywhere OpenSSH is installed, which is everywhere.
Is scp deprecated?
The old SCP protocol was retired, but the scp command remains and now runs over SFTP. It is not going away; it is simply the less capable of the two.
Which is more secure?
Neither — both ride the same SSH transport with the same encryption and the same key authentication. Security is not a factor in this choice.
Full guides for both
Sync directories locally or over SSH, transferring only what changed.
scpThe quickest way to move a file to or from a remote machine.
sshLog into remote machines, run remote commands, use keys instead of passwords, and tunnel ports.
Put it into practice
Other comparisons
curl is an HTTP client for talking to services; wget is a downloader for retrieving files.
sed vs awksed edits lines; awk understands columns. Substitution is sed, computation is awk.
symbolic link vs hard linkA symlink stores a path and can break; a hard link is a second real name for the same file.
grep vs ripgrep (rg)grep is everywhere; ripgrep is dramatically faster on code and respects .gitignore by default.