How to Upload File to Linux Server from Windows

It’s a fine day for another short and sweet tutorial. Today, you’ll learn how to copy a file from Windows to Linux using command line.

First off, do not be intimidated. This tutorial will only take you 5 minutes tops.

Transfer Files from Windows to Linux

There are various reasons why you may want to copy files from Windows to Linux. If you are like me, perhaps you have bought a Linux VPS and are trying to move your website files from the shared hosting account to the new account.

Here are the steps you should follow.

i) Download your website files from your shared hosting account and save them to your computer. I am assuming you are running a Windows PC.

ii) Download PSPC.exe (page download link) Note: make sure you choose the correct version for your computer i.e. 32-bit or 64-bit.

PSCP.exe does not need to be installed. It just runs outrightly on your machine.

iii) Copy the PSCP.exe file to your default System32 folder. In most cases, the folder is in the following path: C:\Windows\System32

iv) Test whether the PSCP.exe can run. To do so, open your Command Line, (CMD.exe) and type pscp

If you see the following output, this means the program is running correctly.

How to Upload File to Linux Server from Windows 1

From here, you are ready to start the upload.

v) Upload your files by typing the following command on your Command console

pscp [PC path to file] \[user@serveraddress]:[path to copy file]

Note: change the values in the parenthesis to your values. See the example below:

pscp C:\Users\Admin\Desktop\websitefiles.zip \ user@194.188.37.3:/home

The file we are uploading is the “websitefiles.zip”

The login credentials for our Linux server are

user@194.188.37.3

The path where we would like to copy the files is ‘/home’

When you press Enter on your command console, you will be prompted to enter your Linux server password.

Copy Files from Linux to Windows Desktop

You can also copy file from your Linux server back to your Windows machine. To do this, we simply need to interchange the command to

pscp [user@serveraddress]:[path to copy file]  [PC path to file]
In our above example, we would have:
pscp user@194.188.37.3:/home/websitefiles.zip   C:\Users\Admin\Desktop\

NOTES

i) If you get the error: pscp not a regular file when trying to upload your files, you will have to copy the file recursively. In this case, use the following command:
pscp -r user@194.188.37.3:/home/websitefiles.zip  C:\Users\Admin\Desktop\

ii) If you get the error: permission denied when executing the pscp command, make sure you are logging into your server as the root user.

There we have it. Let me know if this works for you.

If I helped you, please share the article and consider buying me coffee through the link below:

How to Upload File to Linux Server from Windows 2

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Get more tech stuff like this
in your inbox

Subscribe to our mailing list for occasional amazing tech stuff.

Thank you for subscribing.

Something went wrong.