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.
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 \ email@example.com:/home
The file we are uploading is the “websitefiles.zip”
The login credentials for our Linux server are
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]
pscp firstname.lastname@example.org:/home \ C:\Users\Admin\Desktop\websitefiles.zip
pscp -r email@example.com:/home \ C:\Users\Admin\Desktop\websitefiles.zip
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: