1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-22 00:42:08 +02:00
tldr/pages/common/scp.md
Marco Bonelli ac4094e0ad Refactor: improve consistency of the term "directory".
This commit changes the term "folder" to "directory" in every
instance where the first is used in an example description, but the
second is used in the example code, and vice versa.
2019-02-08 19:43:24 +00:00

956 B

scp

Secure copy. Copy files between hosts using Secure Copy Protocol over SSH.

  • Copy a local file to a remote host:

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

  • Copy a file from a remote host to a local folder:

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

  • Recursively copy the contents of a directory from a remote host to a local directory:

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

  • Copy a file between two remote hosts transferring through the local host:

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

  • Use a specific username when connecting to the remote host:

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

  • Use a specific ssh private key for authentication with the remote host:

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