scp

Secure Copy. Copies files between hosts on a network, using SSH for data transfer and authentication.

Synopsis

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

Core Options

-r

Recursively copy entire directories.

-P port

Specifies the port to connect to on the remote host.

-i identity_file

Selects the file from which the identity (private key) is read.

Usage Examples

Local to Remote

Copy a local file to a remote directory.

scp localfile.txt user@remote:/home/user/

Remote to Local

Copy a remote file to the current local directory.

scp user@remote:/var/log/syslog .

Copy Directory Recursively

Copy an entire local folder to a remote server.

scp -r project_folder user@remote:/var/www/html/

Specify Port

Copy using a non-standard SSH port.

scp -P 2222 file.txt user@remote:~
Built for builders.