scp

scp (secure copy) is used for transferring files between hosts. scp transfers and authenticates data based on the ssh protocol, providing the same security protections as ssh, and prompts for a password when needed. [1]

Syntax

scp [OPTION] [[user@]host1:]file1 ... [[user@]host2:]file2

-P port

-S program

-o ssh_option

-l limit

-i identity_file

-F ssh_config

-c cipher

-r recursively copy an entire directory

-v show progress

-C allow compression

Example

Transfer a file to a remote host

scp com.dotgears.flappybird-1.apk root@192.168.1.1:/data/app/com.dotgears.flappybird-1.apk

Transfer a directory to a remote host whose ssh port is 2222

scp -P 2222 -r /usr/local/app/ root@192.168.1.1:/data/app/

Fetch a directory from a remote host

scp -r root@192.168.1.1:/data/app/ /usr/local/app/

Fetch a file from a remote host whose ssh port is 2222

scp -P 2222 root@192.168.1.1:/data/app/com.dotgears.flappybird-1.apk /usr/local/app/com.dotgears.flappybird-1.apk

References