Skip to content

Instantly share code, notes, and snippets.

@jdesive
Created March 28, 2019 19:00
Show Gist options
  • Save jdesive/100b72dd4b7a7970e9979f7212517b35 to your computer and use it in GitHub Desktop.
Save jdesive/100b72dd4b7a7970e9979f7212517b35 to your computer and use it in GitHub Desktop.
SCP Cheatsheet

Different Port

scp -P 2264 yourfile.txt [email protected]:/some/remote/directory

Files

From Remote to Local

scp [email protected]:yourfile.txt /some/local/directory

From Local to Remote

scp yourfile.txt [email protected]:/some/remote/directory

From Remote to Remote

scp [email protected]:/some/remote/directory/yourfile.txt [email protected]:/some/remote/directory/

Multiple Files From Local to Remote

scp file1.txt file2.txt [email protected]:/some/remote/directory

Multiple Files From Remote to Local

scp [email protected]:~/\{file1.txt,file2.txt\} /some/local/directory

Directories

From Remote to Local

scp -r [email protected]:/some/remote/directory /some/local/directory

From Local to Remote

scp -r /some/local/directory [email protected]:/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 [email protected]:/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 [email protected]:/some/remote/directory

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