Skip to content

Instantly share code, notes, and snippets.

@Banhawy
Created January 25, 2019 16:54
Show Gist options
  • Save Banhawy/411cb7ba08aa742dacb82e1729dc9cc4 to your computer and use it in GitHub Desktop.
Save Banhawy/411cb7ba08aa742dacb82e1729dc9cc4 to your computer and use it in GitHub Desktop.
[SCP] Copy files from and to remote servers #linux #bash
# Copy one single local file to a remote destination
scp /path/to/source-file user@host:/path/to/destination-folder/
# Copy one single file from a remote server to your current local server
scp user@host:/path/to/source-file /path/to/destination-folder
# Copy one single file from a remote server to another remote server
scp user1@server1:/path/to/file user2@server2:/path/to/folder/
# Copy multiple files with one command
scp /path/to/file1.txt /path/to/file2.txt /path/to/file3.txt pete@host.example.com:/home/pete/
# Copy all files in a folder recursively to a remote server
scp -r /path/to/source-folder user@server:/path/to/destination-folder/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment