scp

SSH and Copy and

Syntax

scp [options] source... target

Parameters

ParametersDescriptionExamplesLevel
-r Copy scp -r ./dist user@host:/var/www/ Common
-P ( P) scp -P 2222 file.txt user@host:/tmp/ Common
-i scp -i ~/.ssh/key file.txt user@host:/tmp/ Common
-C scp -C largefile.tar user@host:/backup/ Advanced
-q , scp -q file.txt user@host:/tmp/ Advanced

Examples

scp ./app.jar deploy@server:/opt/app/
Copy

scp user@host:/var/log/app.log ./logs/

scp -r ./build/ user@host:/var/www/html/

Copy

scp user1@host1:/data/file.txt user2@host2:/backup/
Copy

Common Errors

scp: /path/to/file: Permission denied, ssh chmod
scp: not a regular fileCopy -r Parameters, -r Copy

Tips

Related Commands