Skip to content

Instantly share code, notes, and snippets.

@jdesive
Created March 28, 2019 19:00
Show Gist options
  • Select an option

  • Save jdesive/100b72dd4b7a7970e9979f7212517b35 to your computer and use it in GitHub Desktop.

Select an option

Save jdesive/100b72dd4b7a7970e9979f7212517b35 to your computer and use it in GitHub Desktop.
SCP Cheatsheet

Different Port

scp -P 2264 yourfile.txt your_username@remote.host.com:/some/remote/directory

Files

From Remote to Local

scp your_username@remote.host.com:yourfile.txt /some/local/directory

From Local to Remote

scp yourfile.txt your_username@remote.host.com:/some/remote/directory

From Remote to Remote

scp your_username@one.remote.host.com:/some/remote/directory/yourfile.txt your_username@another.remote.host.com:/some/remote/directory/

Multiple Files From Local to Remote

scp file1.txt file2.txt your_username@remote.host.com:/some/remote/directory

Multiple Files From Remote to Local

scp your_username@remote.host.com:~/\{file1.txt,file2.txt\} /some/local/directory

Directories

From Remote to Local

scp -r your_username@remote.host.com:/some/remote/directory /some/local/directory

From Local to Remote

scp -r /some/local/directory your_username@remote.host.com:/some/remote/directory

Increase Performance

By default scp uses the Triple-DES cipher to encrypt the data being sent. Using the Blowfish cipher has been shown to increase speed. This can be done by using option -c blowfish in the command line.

$ scp -c blowfish yourfile.txt your_username@remote.host.com:/some/remote/directory It is often suggested that the -C option for compression should also be used to increase speed. The effect of compression, however, will only significantly increase speed if your connection is very slow. Otherwise it may just be adding extra burden to the CPU. An example of using blowfish and compression:

$ scp -c blowfish -C yourfile.txt your_username@remote.host.com:/some/remote/directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment