scp Command Examples

Secure copy. Copy files between hosts using Secure Copy Protocol over SSH. More information: https://man.openbsd.org/scp.

scp {{path/to/local_file}} {{remote_host}}:{{path/to/remote_file}}

scp -P {{port}} {{path/to/local_file}} {{remote_host}}:{{path/to/remote_file}}

scp {{remote_host}}:{{path/to/remote_file}} {{path/to/local_directory}}

scp -r {{remote_host}}:{{path/to/remote_directory}} {{path/to/local_directory}}

scp -3 {{host1}}:{{path/to/remote_file}} {{host2}}:{{path/to/remote_directory}}

scp {{path/to/local_file}} {{remote_username}}@{{remote_host}}:{{path/to/remote_directory}}

scp -i {{~/.ssh/private_key}} {{path/to/local_file}} {{remote_host}}:{{path/to/remote_file}}

scp -J {{proxy_username}}@{{proxy_host}} {{path/to/local_file}} {{remote_host}}:{{path/to/remote_file}}