Skip to content

Instantly share code, notes, and snippets.

@dsaiztc
Forked from dehamzah/scp-cheatsheet.md
Created November 8, 2018 17:56
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 dsaiztc/e03d2fe5323f212f4400789172de810f to your computer and use it in GitHub Desktop.
Save dsaiztc/e03d2fe5323f212f4400789172de810f 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