scp report.pdf jane@server:/home/jane/Upload a file to the server.
When to use it
Use scp for quick one-off copies over SSH. For large or repeated transfers, rsync is better because it resumes and copies only what changed.
Steps
Upload a file
Source first, destination second. The remote side is user@host:path.scp notes.txt jane@203.0.113.10:~/Download a file
Swap the order.scp jane@203.0.113.10:~/backup.tar.gz .Copy a folder
-r copies recursively.scp -r ./site jane@203.0.113.10:/var/www/Use a port or a key
Note the capital -P for the port (ssh uses lowercase -p).scp -P 2222 -i ~/.ssh/work_ed25519 file.zip jane@host:/tmp/
Output explained
scp shows one progress line per file:
backup.tar.gz 100% 148MB 42.3MB/s 00:03
Since OpenSSH 9.0, scp uses the SFTP protocol under the hood. Paths with spaces need quoting once, like '~/My Files/'. The old protocol is available with -O for servers without SFTP.
Options and variations
| Flag | Meaning | Example |
|---|---|---|
| -r | Copy folders recursively | scp -r dir host:/tmp/ |
| -P PORT | SSH port (capital P) | scp -P 2222 f host: |
| -i KEY | Identity file | scp -i key f host: |
| -p | Preserve times and modes | scp -p f host: |
| -C | Compress during transfer | scp -C big.log host: |
| -O | Use the legacy SCP protocol | scp -O f oldhost: |
Common errors
| Error | Cause | Fix |
|---|---|---|
| No such file or directory | Wrong path on either side | Check the remote path with ssh host ls PATH. |
| Permission denied | No write access to the destination folder | Copy to your home directory first. |
| subsystem request failed | Server has no SFTP subsystem | Add -O for the legacy protocol. |
Do it in the app
LightAtom's connections view shows the SSH connection's live upload or download rate while scp runs.
Frequently asked questions
How do I copy a file from a server to my Mac?
scp user@host:/path/to/file ~/Downloads/ copies it into your Downloads folder.
Is scp deprecated?
The old SCP protocol is, but the scp command remains; since OpenSSH 9.0 it uses SFTP underneath. For big or repeated transfers, rsync -avz is better.
Why does scp use -P and ssh -p?
scp's -p was already taken by “preserve times and modes”, so the port option is a capital -P.