Both tools copy files over SSH, so they work with the same login as your terminal. Use scp for a quick single file and rsync for folders and repeat copies, because it sends only what changed. Run these commands on your own computer (Linux or macOS; on Windows 10 and later scp works in PowerShell, rsync needs WSL).
scp file.txt USER@YOUR-IP:/home/USER/ # upload one file
scp USER@YOUR-IP:/var/log/app.log . # download to the current folder
scp -r mysite/ USER@YOUR-IP:/home/USER/ # a whole folder
scp -P 2222 file.txt USER@YOUR-IP:/home/USER/ # if SSH is on another portrsync -avz --progress mysite/ USER@YOUR-IP:/home/USER/mysite/
rsync -avz -e "ssh -p 2222" mysite/ USER@YOUR-IP:/home/USER/mysite/
-a keeps permissions and times, -v shows files, -z compresses. Rsync needs to be installed on both ends (sudo apt install rsync or sudo dnf install rsync). Run it again and only the changes are sent.
mysite/ copies the contents of the folder into the target; mysite without the slash creates a mysite folder inside the target.--dry-run to see what would happen without copying anything.--delete removes files from the target that are not in the source. Use it only after a dry run and never with a wrong target path.Fast VPS from $7.99 a month.
What is the difference between scp and rsync?
Both copy files over SSH. scp is quick for a single file; rsync is better for folders and repeated copies because it sends only what changed.
Why did rsync create an extra folder?
A source path without a trailing slash copies the folder itself into the target; with a trailing slash it copies the contents.
How do I check what rsync will do?
Add --dry-run to the command: it shows the changes without copying anything.
Is rsync --delete safe?
It removes files from the target that are not in the source. Use it only after a dry run and double-check the target path.