SCP Cheatsheet
SCP stands for Secure Copy, it enables the secure transfer of files between two hosts over a network.
Basic Syntax: scp <options> <source> <destination>
Full Documentation for SCP:
scp(1): secure copy - Linux man page
scp copies files between hosts on a network. It uses ssh(1) for data transfer, and uses the same authentication and provides the same security as ssh(1).…
My Most Commonly Used SCP Commands.
Command | Purpose |
---|---|
scp user@remote:/path/to/remote/source /path/to/local/destination/
|
Copy file from remote source to local destination |
scp /path/to/local/source user@remote:/path/to/remote/destination/
|
Copy file to remote destination from local source |
scp -i ~/.ssh/myPrivateKey.pem user@remote:/path/to/remote/source /path/to/local/destination/
|
Copy file from remote source to local destination using SSH-Keys. |
scp -i ~/.ssh/myPrivateKey.pem /path/to/local/source user@remote:/path/to/remote/destination/
|
Copy file to remote destination from local source. |
Option | Purpose |
---|---|
-r
|
Transfers recursively, used for transferring a directory. |
-v
|
Verbose output, will display the transfer information in realtime. |
-c
|
Use compression for transfer. |
-l int
|
Limit the transfer throughput, good for shared connections, to limit network impact. |
-p
|
Preserve original attributes for each copied file. |
-P
|
Specify the connection port. |
-q
|
Quiet transfer mode. Do not display the output in shell. |
-i
|
Specify the private key / identity file to use for the connection. |
Recommended Reading

Linux Shell Scripting Cookbook - Third Edition: Do amazing things with the shell and automate tedious tasks
Author(s): Clif Flynt, Sarath Lakshman, Shantanu Tushar