[email protected]Support 24/7 · Billing 09:00 – 00:00LinkedInXFacebook
NexonHost
Netherlands Dedicated ServersAmsterdam · Equinix AM6Germany Dedicated ServersFrankfurt · Equinix FR4Romania Dedicated ServersBucharest · VoxilityAustria Dedicated ServersVienna · Interxion VIEBulgaria Dedicated ServersSofia · TelepointFrance Dedicated ServersParis · Interxion PAR — Marseille · Digital Realty MRS3Ireland Dedicated ServersDublin · Equinix DB2Italy Dedicated ServersMilan · Irideos AvalonPoland Dedicated ServersWarsawSpain Dedicated ServersMadrid · Equinix MD2United States Dedicated ServersAshburn · Equinix DC
All articles
Getting startedAugust 10, 2023

How to transfer file between servers with scp command.

What is scp command?

The scp command stands for “secure copy” and is a command-line tool used to securely transfer files between local and remote systems over a secure SSH (Secure Shell) connection. Here are some key points about the scp command:

  • scp is primarily used in Unix-like operating systems, including Linux and macOS.
  • It allows you to copy files and directories between local and remote systems or even between two remote systems.
  • The basic syntax of the scp command is:
scp [options] <source> <destination>

Copy files using SCP command in Linux

The steps to copy files from one server to another server are:

  • Step 1: Get login information for each server.
  • Step 2: Get file path of the files to be copied.
  • Step 3: Login to the second server and use scp command to copy files.

Get login information for each server.

Assume we have to copy a file F from server A to server B. Get the Login information for both servers. Be sure to get the IP address of the servers as the hostname will not work with scp command which we will use.

To get the IP address of the system you are logged, use the following command:

ifconfig

It will be as follows:

  • Server A
    • Username: userA
    • Password: pswA
    • IP: XX.XX.XX.XX
  • Server B
    • Username: userB
    • Password: pswB
    • IP: XX.XX.XX.XX

Get file path of the files to be copied.

Login to remote server using an utility like MobaXterm.

Get the file path of the file you want to copy. If you want to copy an entire directory, get the absolute path of the directory.

We can get the absolute path of the current position we are on using the following command:

pwd

It will give an output as:

/rot

It might be that you need to copy the file named “information.txt” in the current location.

Step 3: Login to the second server and use scp command to copy files.

In this step, login to server B where you want to copy the files and go to the location you want to keep the files. Once done, use the following command to copy file named “information.txt” from server A to current server:s

scp [email protected]:/file.txt

Note:

  • . is to get the file in the current working directory. We can specify a path instead it.

For our case, the real command is:

scp '/home/liviu.desktop//file.txt' [email protected]:/root

To copy the entire directory, use scp -r. The command will be as follows:

scp -r '/home/liviu.desktop//file.txt' [email protected]:/root

You will be prompted to enter the password of the server A from where files are to be copied. Type the password (will not be visible on screen) and press ENTER key.

With this, you will copy your file or directory successfully.

Alternative approach using WinSCP

In this approach, we need not login to the remote server using a terminal utility. You can browse through the files in a server using an utility like WinSCP.

The approach is as follows:

  • Step 1: Login to server A using WinSCP
  • Step 2: Download the files from server A to your local system (Windows)
  • Step 3: Login to server B using WinSCP
  • Step 4: Upload the local files to server B

To download and upload files, you just need to select the concerned files and drag it to the appropriate location.

With this, you must have a strong idea of how to copy files from one remote server to another remote server.

Keep reading
How to understand difference between rpd and vpn.
March 1, 2023

How to understand difference between rpd and vpn.

How To Understand Difference Between Rpd And Vpn. A VPN (Virtual Private Network) is a simple software that was created to protect your online privacy and make life harder for hackers by anonymizing your traffic and location. But you can also use it for many other things like fast and secure…

Read article
How to install Debian 10
February 28, 2023

How to install Debian 10

How To Install Debian 10 Connect to java/html5 console, (here you can find an article that will show you how) How to access java/html5 console : Mount ISO: Virtual media &gt; Connect Virtual Image &gt; Map CD/DVD Click on: Connect Virtual Media. Click on: Map CD/DVD. Now click on: Map Device. Next…

Read article
How to understabd VPN
February 28, 2023

How to understabd VPN

How To Understand VPN. To understand how a VPN works, it helps to first understand how your internet connection works without one. Without a VPN When you access a website without a VPN, you are being connected to that site through your internet service provider, or ISP. The ISP assigns you a…

Read article
Get in Touch

Together, Let’s Build a Faster, Safer Internet.

Build scalable infrastructure with NexonHost — high-performance dedicated servers, VPS hosting, cloud hosting, and DDoS protection across Europe.

Get Started →Contact Us
[email protected]Support 24/7 · Billing 09:00 – 00:00