This article will show you how you can transfer files between two servers. It doesn’t matter how large files are, between servers you can transfer file of any size. Whether it’s too big file or too small.
You have to login to your server using SSH and then follow below listed commands as per your requirement. So, connect your web server with putty and get to the ssh terminal. Following are some scp commands which can be used. In this commands change path according to your directory.
I will be using scp command to transfer files.
scp stands for Secure Copy, it’s used for copying file from local to remote server and vice versa.
It uses ssh for data transfer and provides the same authentication and same level of security as ssh.
We can transfer files from
- local to remote machine
- remote to local machine
- remote to remote machine
Copy the file “myfile.zip” from a remote host to a the local host
$ scp your_username@remotehost.edu:myfile.zip /some/local/directory
Copy the file “myfile.zip” from the local host to a remote host
$ scp myfile.zip your_username@remotehost.edu:/some/local/directory
Copy the file “myfile.zip” from the local host to a remote host using port 2264
$ scp -P 2264 myfile.zip your_username@remotehost.edu:/some/remote/directory
Copying the files “foo.txt” and “bar.txt” from the local host to your home directory on the remote host
$ scp foo.txt bar.txt your_username@remotehost.edu:~
Copy multiple files from the remote host to your current directory on the local host
$ scp your_username@remotehost.edu:/some/remote/directory/\{a,b,c\} .
$ scp your_username@remotehost.edu:~/\{foo.txt,bar.txt\} .
Copy the file “myfile1.zip” from remote host “remote1.com” to remote host “remot2.com”
$ scp your_username@remote1.com:/some/remote/directory/myfile.zip \ your_username@remote2.com:/some/remote/directory/