How to copy files from one server to another using SSH?

Transfer files from server to server by using SSH is very convenient. You can use the server’s download and upload speed to transfer files.

Login to your old server from which you want to copy or transfer files. You can use any SSH terminal like PuTTY or MacBook’s Terminal.

ssh userName@hostname

in most cases username is root and hostname is your server IP address

ssh root@

In normal case SSH/SFTP port number is 22. By any chance if your servers’ port number is different then you have add your port number like this

ssh root@ -oPort=2200

System will ask for password, just type it and enter the server.

Now using terminal go to your desired folder location. In my case I want to zip and and download the whole pulic_html folder of my website.

cd /home/webupdate24

Now You have to zip the whole public_html folder using the command below.

tar -cvzf siteBackup.tar.gz public_html

File transfer from old server to new server using SSH

On the same terminal login to your destination server.


Now go to your desired folder location.

cd /home/newWebupdate24

Copy the file from the old server to this new server using the command below.

put siteBackup.tar.gz

, ,