Guide

Copy files to and from a VPS with scp and rsync

Last updated: 15 November 2026

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).

Fast VPS from $7.99 a month

See Fast VPS plansHow ordering works

scp

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 port

rsync

rsync -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.

Good to know

Fast VPS from $7.99 a month.

Questions and answers

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.

Ready to try it? Fast VPS from $7.99 a month

See Fast VPS plansHow ordering works