How to transfer files from one linux server to another

linux server

In a multi-server Linux environment, you’d want to transfer several files at once from one Linux server to another. Depending on the number and type of files involved, there are several ways you can carry out the operation.

Transferring a single file from one Linux server to another:

linux server

For a single file:

In this case, you can make use of the “SCP” command. It is basically a “push” / “pull” command with a built-in SSH command that basically pushes your file from its origin to the destination server with little effort.

Command:

Open the 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.

scpfileuser@target_host:target_folder

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:

scpuser@target_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 can act in a loop till all files get copied. The command would read as shown below.

scp -r directoryuser@target_host

The complete directory gets copied to another system.

Copying multiple files from one Linux server to another

When the number of files involved are more than one, it gets sort of troublesome to transfer them one by one. A better way to achieve the same intended result is to transfer the entire directory or a bunch of files at once.

This can be done using the ‘tar’ command. ‘Tar’ creates a collection of files that act as one unit and can be transferred the same way we did in point 1. This singular file thus created follows the same rule of commands as other files.

Does your server slow down while transferring files?

Bring home a more robust and powerful Linux server powered by intel Xeon chips featuring up to 32 cores and 1 GBPS bandwidth.

Chat Now.

Have questions?

Ask us.



    AWS Standard Consulting Partner

    • Go4hosting
    • Go4hosting

    Alibaba Cloud

    Go4hosting

    Go4hosting-NOW-NASSCOM-Member Drupal Reseller Hosting Partner

    Cyfuture Ltd.

    The Cricket Barn
    Tiverton
    Exeter
    EX16 8ND

    Ph:   1-888-795-2770
    E-mail:   [email protected]