How to Transfer Files from one Linux Server to Another
The Linux system is endowed with many different file transferring functions. Each function is unique in use and application. Following is the list of the most commonly used file transferring functions when you need to transfer files from one Linux server to another.
Instructions
-
-
1
Type the command:
ftp servername
File transfer protocol (ftp) is the standard cross-platform interactive tool for file transfers. Provide your username and password when prompted. The ftp session will begin. -
2
Enter the command:
sftp servername
Secure ftp (sftp) uses an encrypted session, making it a better choice for unsecured networks. -
-
3
Use the remote command copy (rcp) of BSD on trusted, secured networks only. The basic syntax is:
rcp.
rcp file1 linuxhost2:/temp -
4
Secure copy (scp) is an encrypted version of rcp. The transfer is sent over an encrypted Secure Shell (ssh) session. The syntax is essentially the same:
scp linuxhost2:/temp/file2 /var/tmp -
5
Copy or synchronize entire directories, using the rsync command:
rsync -oupgrle ssh /local/directory host2:/remote/directory
Check the manual page for rsync to describe the options listed.
-
1
Tips & Warnings
The fastest and easiest way to copy a file is to set up scp so that it uses public-key authentication. Public-key authentication is extremely powerful and convenient with the added security of an encrypted session.
rsync can be in used combination with public-key authentication to update entire directories at regular intervals. Call the rsync command from the Linux scheduler (cron) at predetermined times to keep remote directories up-to-date.
Whenever possible, use scp instead of rcp. scp is more secure than rcp.