scp or rsync — and why rsync sent 141 bytes instead of two megabytes the second time

We took a two-megabyte project folder and sent it with rsync. 2,000,669 bytes went out — fair enough. Then we changed one line in one file and ran the same command again. 141 bytes went out.
scp would have sent all two megabytes again the second time. That's the main difference between the two commands people use to copy files to a server. Let's see what else separates them and which one you should reach for.
In short: the difference
Both commands copy files between your computer and a server over SSH. Same keys, same user@server address, same level of security.
scpis "copy, but to a server". Like regularcp, except one path is remote. It takes the files and ships them whole. Every time.rsyncis "synchronize". It first compares what's already on the other side and ships only the difference. Even inside a changed file, only the changed chunks.
scp -r ./site user@server:/var/www/
rsync -av ./site/ user@server:/var/www/site/
Point by point
- Speed on repeat. scp copies everything every time. rsync, only the changes. For a repeat deploy the gap can be thousands of times, like in our example.
- Dropped connection. scp starts over after a drop. rsync you just run again — it finishes what's missing.
--partialeven keeps a half-transferred big file. - Exclusions. rsync has
--exclude: for example,--exclude node_moduleswon't haul thousands of dependency files to the server. We checked — that folder never appeared on the other side. scp has nothing like it. - Dry run.
rsync -n(or--dry-run) shows what would be copied and deleted without touching anything. scp can't do that. - Availability. scp ships with SSH almost everywhere, including Windows 10 and 11. rsync must be installed on both sides. If the server lacks it, you'll see
rsync: command not found. On Windows, rsync lives in WSL. - What you see along the way.
rsync -avprints every file it sends, and with--progressalso percentages for big files. scp shows a progress bar but never says what it skipped or deleted: it simply has nothing to skip. - Learning curve. scp makes sense on day one. rsync has more flags and a slash trap — more on that below.
- Under the hood. Since OpenSSH 9.0 (2022), scp itself transfers files over the SFTP protocol. The old protocol stays behind the
-Oflag, for very old servers.
The rsync trap: a trailing slash
This is the one thing to remember about rsync. A single character changes the result:
rsync -a proj dest/ # you get dest/proj/...
rsync -a proj/ dest/ # you get dest/... — the contents, no wrapper
We tested both. Without the slash, rsync copies the folder itself. With it, what's inside. Mix them up and the server gets site/site/index.html, while the site keeps serving the old version.
The second trap is --delete. It removes everything on the server that you don't have locally. For an exact mirror, that's precisely what you want. But combined with a wrong slash, it can wipe someone else's files on the other side. So the rule is simple: run any command with --delete with -n first and read the deleting lines.
Who should use what: the verdict
No fence-sitting:
- One file, once —
scp. Push a.envto the server, grab a database backup, download a log. Type it and forget it. No flags to learn — the syntax is plain copying. - A folder you'll upload again and again —
rsync. A homemade site deploy, syncing images, backups. With--excludeand a-ndry run, it's the most reliable simple approach. - Big files over a shaky connection —
rsync --partial. No starting from zero after every drop. - A server where you can't install anything —
scp. It's always there.
And if you deploy an app regularly, both commands are a stepping stone. The usual next step is hosting that deploys on git push; we walked through that path in how to deploy your app.
FAQ
Can I download a file from the server instead of uploading?
Yes, both commands work in both directions. Just swap the paths: scp user@server:/var/log/app.log . downloads the log into the current folder.
Why didn't rsync work when ssh connects fine?
Most often rsync isn't installed on the server — it needs a partner on the other side. Install it there: sudo apt install rsync.
Is scp safe if people call it outdated?
What was outdated is the old transfer protocol, not the command. Modern scp runs over SFTP, and it's perfectly fine for simple copying.
The AI Architect 2027 course: step by step from computer basics to your own app and first customers. 543 short lessons on your phone.





