Transferring files from one server to another is inevitable in a multi-server Linux environment. There are many commands that can help you to carry out the file transfer task. But this would depend on the number of files that need to be transferred.
Transferring a single file from one Linux server to another:
For a single file:
In this case, you can make use of the "SCP" command. It is basically a "push" / "pull" command with built in SSH command which can be used here for pushing your file from server 1 to server 2. It copies the file in a safe manner. Read through the following steps to know the process.
Open a tool 'PuTTY'. It is a terminal emulator application. It acts as a client for computing protocols such as SSH, Telnet, rlogin, and TCP. It can be easily downloaded for free directly from Google.
Type the file transfer command in the following convention.
It reads as "copy file" into "target_folder" at "target_host" using "user account".
So the file gets copied to another system, into the mentioned user id. This file can be pulled from another system with the command as shown below:
[email protected]_host:target_folder file.
For copying an entire directory:
Make use of the "SCP" command here as well. Add the -r switch so that the copy function an act in a loop till all files get copied. The command would read as shown below.
scp -r [email protected]_host
The complete directory gets copied to another system.
A huge number of files as well as directories:
In case there are enormous number of files and directories that need to be copied, make use of the 'tar' command. This command creates a single file out of the entire directory and file collection. This singular file can be copied as directed above.
There are many other ways to carry out this task because of n-number of Linux tools available in the market. But whatever may be the case, make use of correct file names, user IDs and directory names for a secured file transfer.
Please fill in the form below and we will contact you within 24 hours.