Skip to content

Instantly share code, notes, and snippets.

@dehamzah
Last active December 11, 2023 10:26
Show Gist options
  • Star 20 You must be signed in to star a gist
  • Fork 13 You must be signed in to fork a gist
  • Save dehamzah/ac216f38319d34444487f6375359ad29 to your computer and use it in GitHub Desktop.
Save dehamzah/ac216f38319d34444487f6375359ad29 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