Learn how to copy files and folders from/to another server

You want to copy some files and folders from another server? We will show how to do this action. We will use now the scp command. For more information check the link from the bottom of the article.

scp uses SSH protocol for data transfer, and uses the same authentication and provides the same security as SSH

The scp syntax to copy files/folders from a remote server to the local server:

scp username@remote_host:remote_file /local_directory
scp -r username@remote_host:remote_directory /local_directory

The scp syntax to copy files/folders from the local server to a remote server:

scp local_file username@remote_host:/remote_directory
scp -r /local_directory username@remote_host:/remote_directory

Example on how to copy a file from a remote server:

scp root@remote_host:/home/username/cpmove-username.gz /home/

Example on how to copy a whole directory from a remote destination:

scp -r root@remote_host:/home/username/public_html /transfer

remote_host can be an IP or a domain name.


Leave a Reply