Beginners Guide: Copy Your Files To Remote Server With scp

When you are moving your website to another server or maybe copying a file to a remote host, there are lot ways to do that. One of them is using “scp” or secure copy. scp is used for copying file from local to remote host securely. It uses ssh for data transfer and provides the same authentication and same level of security as ssh.

Copy a file from a remote host to the local host:

scp [email protected]:file.txt /path/local/directory

Copy a file from the local host to a remote host:

scp /path/local/directory  [email protected]:file.txt

Copy a directory from local host to a remote host

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

Copy a directory from remote host to a local host

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

Copy a file from remote host 1 to remote host 2 (copy file between remote host)

scp [email protected]:/path/remote/host1/file.txt [email protected]:/path/remote/host2/

Use blowfish cipher to encrypt the data being sent:

scp -c blowfish /path/local/directory  [email protected]:file.txt

Compress the file before send:

scp -c blowfish -C /path/local/directory  [email protected]:file.txt

Give me your feedback

This site uses Akismet to reduce spam. Learn how your comment data is processed.