scp command
Copy files between computers over SSH.
- Downloads & file transfer
- Package openssh-client
- 6 options · 6 examples
Syntax
scp [options] source… destinationProvided by the openssh-client package. Run man scp for the full manual.
Common options
| Option | What it does |
|---|---|
-r | Copy directories |
-P PORT | SSH port (capital P) |
-i FILE | Private key |
-p | Keep times and modes |
-C | Compress during transfer |
-l KBIT | Limit the bandwidth |
Examples
Upload a file
scp backup.tar.gz user@server:/tmp/Download a file
scp user@server:/var/log/syslog .Copy a directory
scp -r site/ user@server:/var/www/Use another port
scp -P 2222 file.txt user@server:~Use a key
scp -i ~/.ssh/key.pem app.zip ubuntu@server:~Between two remote hosts
scp user@a:/data/file user@b:/data/
No example matches. Check the options table or search the guides.
Tips
- For big or repeated copies,
rsyncis faster and can resume.
scp guides
- Resolved ‘bash: scp: command not found’ Issue in Linux Security · Updated Apr 2025
- How to Pass Password to ssh/scp Command in Bash Script Shell Scripting · Updated Apr 2025
