GNU/LinuxSCP

Syntax

Basic Usage

# Copy remote file to local dir
scp [email protected]:/remote/path/to/foobar.md /local/dest

# Copy local file to remote dir
scp foobar.md [email protected]:/remote/dest

# Key files can be used (just like ssh)
scp -i my_key.pem foobar.md [email protected]:/remote/dest

Secure Copy

scp command is used to securely copy a file to or from a remote destination. If the file is in current working directly only filename is sufficient else full path is required which included the remote hostname e.g. [email protected]_server.org:/path/to/file

Copy local file in your CWD to new directory

scp localfile.txt /home/friend/share/

Copy remote file to you current working directory

scp [email protected]:/home/rocky/game/data.txt ./

Copy file from one remote location to another remote location

scp [email protected]:/beacon/light/bitmap.conf [email protected]:/beacon/night/

To copy directory and sub-directories use '-r' recursive option to scp

scp -r [email protected]:~/project/* ./workspace/