Skip to content

Instantly share code, notes, and snippets.

@psamsotha
Forked from dehamzah/scp-cheatsheet.md
Created October 27, 2017 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save psamsotha/381406b7c25616d45342423dc58fa749 to your computer and use it in GitHub Desktop.
Save psamsotha/381406b7c25616d45342423dc58fa749 to your computer and use it in GitHub Desktop.
SCP Cheatsheet

Basic Syntax

$ scp source_file_path destination_file_path

Uploading

Single file

$ scp ~/my_local_file.txt user@remote_host.com:/some/remote/directory

Multiple files

$ scp foo.txt bar.txt username@remotehost:/path/directory/

Downloading

Single file

$ scp user@remote_host.com:/some/remote/directory ~/my_local_file.txt

Multiple files

$ scp username@remotehost:/path/directory/\{foo.txt,bar.txt\} .

Extra Options

Verbose Output

$ scp -v source_file_path destination_file_path

Copy Entire Directory (Recursively)

$ scp -r source_file_path destination_file_path

Speed Up Transfer with Compression

$ scp -C source_file_path destination_file_path

Specify Identity File

$ scp -i private_key.pem ~/test.txt root@192.168.1.3:/some/path/test.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment