Transfer large files between two servers

transfer-large-files-server-to-server-scp

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 [email protected]:myfile.zip /some/local/directory

Copy the file “myfile.zip” from the local host to a remote host

$ scp myfile.zip [email protected]:/some/local/directory

Copy the file “myfile.zip” from the local host to a remote host using port 2264

$ scp -P 2264 myfile.zip [email protected]:/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 [email protected]:~

Copy multiple files from the remote host to your current directory on the local host

$ scp [email protected]:/some/remote/directory/\{a,b,c\} .
$ scp [email protected]:~/\{foo.txt,bar.txt\} .

Copy the file “myfile1.zip” from remote host “remote1.com” to remote host “remot2.com”

$ scp [email protected]:/some/remote/directory/myfile.zip \
[email protected]:/some/remote/directory/ 

Shyam has written 29 articles

Shyam is senior full stack developer, who loves to explore new technologies and work on them. He's passionate about coding so can code 24/7. He uses PHP as a backend programming language.

He knows Laravel, MySQL, AngularJS, ReactJS, Redis, Kubernetes, Git, CodeIgniter, PHP, MVC pattern, Lodash, jQuery, VanilaJS, Teamcity and many other technologies and tools.

Shyam writes notes and hacks on his blog (https://shyammakwana.me). In spare time he can be found @ StackOverflow or crafting any new open source application.

Passionate Programmer and Meditator #PERIOD.