How to Transfer Files to a Linux VPS using SSH?

While file transfer between windows systems is easy and straightforward, it is a little tricky when it comes to transferring files between a windows system and a Linux VPS. However, it can be done easily using SSH.

In Windows, you can just copy/paste a file or folder to a different Windows VPS or PC. In a Linux system, you can do it easily too by following some small steps.

Here we will show you how to transfer files from a windows system to a Linux VPS running Ubuntu OS. For this tutorial, we will be using PuTTy which is a popular SSH client to transfer the files.

Here are the steps you need to follow:

Transferring files between a local PC and Linux VPS:

Step 1: Download PuTTy and PuTTy SCP (pscp).

  • Firstly, you need to download PuTTy, and PuTTY SCP (pscp) if you don’t have it in your system.
  • Secondly, ensure pscp.exe is in your system’s PATH or navigate to its directory using the command prompt.

Step 2: Transferring files using “pscp”.

  • Firstly, open Command Prompt. You can either search and open it or just use Windows key + R, then type cmd to open it.
  • Secondly, navigate to the directory containing the “pscp.exe”. You can do that by running this command in the CMD.
Code
cd C:\Program Files\PuTTY
Transferring files using “pscp”

  • Now, use the following command to transfer the file to the Linux VPS.

Command format:

Code
pscp path\to\local\file username@VPS_IP:/path/to/remote/directory
To transfer C:\Users\YourUser\Documents\transfer.txt to /home/your_vps_user/ on the VPS, use this command:
Code
$ pscp C:\Users\YourUser\Documents\transfer.txt your_vps_user_name@VPS_IP:/home/your_vps_user/
If your VPS’s IP is: 184.164.81.56 and your files name is: transfer_test.txt and the VPS’s username is root, then the command will look like this:
Code
pscp “C:\Users\farha\Documents\transfr\transfer_test.txt” root@184.164.81.56:/home/
Command Prompt
Now if you want to move a folder to the linux VPS, then the command will look a bit different.

Command format:

Code
pscp -r path\to\local\folder username@184.164.81.56:/path/to/remote/directory
If your folder’s name is “transfr”, then the actual command will look like this:
Code
pscp -r “C:\Users\farha\Documents\transfr” root@184.164.81.56:/home/

Transfer folder command

Step 3: Verify if the file has been transferred successfully.

  • If you want to check if the file has been transferred, then open PuTTy and login to the VPS.
  • Then Navigate to the directory where you transferred it.
  • After that go to the directory by using $ cd home.
  • Then use this command: $ ls

root speed test
If you want to remove the file, then use the “rm” command.

Step 4: Removing a file or directory if needed.

Code
rm tranfer_test.txt
  • Then use this command: $ ls

Removing a file or directory (if needed)
If you want to remove a directory, then use “rm -r” command

Code
rm -r transfr
  • If you type $ ls again, you will no longer see the file or directory there.

Remove a directory

This concludes how you can easily transfer files from your Windows VPS or PC to a Linux VPS via SSH.

Transferring files between two Linux VPS:

You can also transfer files from one Linux VPS to another Linux VPS. For that follow the instructions given below:

  • Firstly, open Command Prompt and login to your Source VPS that contains your files, then type this command and hit enter:
Code
ssh root@source_vps_ip
Command Prompt ssh root

  • Enter your VPS password. (You may be asked to type yes or y to confirm the connection before entering the password).
  • Secondly, you need to determine which file you want to transfer and the location/directory of the file.

root file-transfer

  • In this case, you can use the “scp” command to move files between a source VPS and a destination VPS.

General Command format:

Code
scp “/home/folder1/filename.ext” root@destination_ip:/home/folder2/filename.ext

Here “/home/folder1/filename.ext” is the location/directory of the file in the source VPS. This part is for the destination VPS “root@destination_ip:/home/folder2/filename.ext”.
Here root@destination_ip is the username@destination_ip, :”/home/folder2/filename.ext” is the destination directory to transfer the file/folder.

Example:

For Example, If the Destination VPS’s IP is: 170.205.52.101 and the username is “root”; and the file is in “home/transfer” directory in the Source VPS (184.164.81.56), then use the following command to transfer the file:

Code
scp “/home/transfr/new_file.txt” root@170.205.52.101:/home/

Transfer root file directory
If you check in this Destination VPS: 170.205.52.101 you will see the file there.
root folder
If you want to transfer the whole folder/directory, then just add “-r” after “scp”.
The command will look something like this:

Code
scp -r “/home/transfr/” root@170.205.52.101:/home/

Transfer the whole folder/directory
If you check again, you will see the folder there now.
Transfer Root Folder
You can transfer files from VPS (170.205.52.101) to VPS (184.164.81.56) too. Just change the IP and directory name accordingly.

Code
scp "/file name" root@184.164.81.56:/home/

For folder/directory:

Code
scp -r "/Folder or directory name/" root@184.164.81.56:/home/
This is how you can transfer files between two different Linux VPS easily.

Transferring files from a VPS to a local system

You can transfer files from your VPS to your local system too by following these few simple steps:

  • Firstly, open Command Prompt
  • Secondly, run this command:
Code
pscp root@source_vps_ip:file_location "Destination_folder_or_location"/

Example:

Code
pscp root@192.144.32.8:/root/test_file.txt "C:\Users\Test\Downloads\Folder_1"
This is how you can transfer your files from your VPS to your local PC without using any external applications.

FireVPS offers both Windows VPS or RDP and Linux VPS. Buy Windows VPS/RDP and Ryzen Linux VPS from FireVPS for your VPS hosting needs. If you face any issue or have any concerns, knock us directly from our website’s Live Chat. Our support team is already ready to help you.

FireVPS / Live Chat / Skype / support@firevps.net

Need Domain Name?

85% Promo on Domain Names

Dedicated RDP

Poland RDP 50% recurring discount!

Recent Post

How to migrate ImapSync to migrate to FireVPS Business Email

****Do not change the DNS setting now. Once the migration is completed then change the DNS setting. Here is the step-by-step procedure: Step 1: Sign into your FireVPS Business Email Control Panel which we already provided via a welcome email: Link:...

How to migrate NameCheap to FireVPS Business Email

****Do not change the DNS setting now. Once the migration is completed then change the DNS setting. Here is the step-by-step procedure: Step 1: Sign into your FireVPS Business Email Control Panel which we already provided via a welcome email: Link:...

How to migrate HostGator to FireVPS Business Email

****Do not change the DNS setting now. Once the migration is completed then change the DNS setting. Here is the step-by-step procedure: Step 1: Sign into your FireVPS Business Email Control Panel which we already provided via a welcome email: Link:...

How to migrate GoDaddy to FireVPS Business Email

****Do not change the DNS setting now. Once the migration is completed then change the DNS setting. Here is the step-by-step procedure: Step 1: Sign into your FireVPS Business Email Control Panel which we already provided via a welcome email: Link:...