This article will assist you to transfer web content between two remote Linux machines.
cPanel to cPanel migration
Manual migration using SFTP
SFTP (SSH File Transfer Protocol or Secure File Transfer Protocol) offers secure connection to transfer files between Linux machines. SFTP is highly preferable over FTP because SFTP uses the SSH protocol to authenticate and establish a secure connection.
Connect to VPS using SFTP
If you could connect to your VPS through SSH, then you have all necessary requirements to use SFTP. Connect to your VPS through sFTP via the following command.
sftp [email protected]_address_of_vps
You will be prompted for the password, specify your SSH password and you will get connected to the remote system. This will also change shell prompt to SFTP. After connecting to your remote machine via SFTP, you can navigate to the remote machine file system using cd command.
To know the current working directory pwd command is used. To view contents of the current directory ls command is used.
phpinfo.php info.html Directory1 Directory2
When you want to traverse the local file system, you can direct commands towards the local file system by just adding "l" before any command. For example; you can print the local working directory by command lpwd.
Local working directory: /home/user/Desktop
Similarly, we can list the contents of the current directory on the local machine using lls command and change the directory using lcd command.
Upload/Transfer local files to VPS
You can upload/transfer local files to VPS using put command.
put file_name Uploading file_name to /home/user/directory/file_name
To copy an entire local directory to VPS, you can issue following command.
put -r local_dir_name
Download VPS files to local computer
Sometimes, you are required to download VPS files to local computer. It can be accomplished by issuing the following command.
get file_name Fetching /home/user/Desktop/file_name to file_name
If you want to copy whole directory along with its contents, issue following command.
get -r remote_dir_name