In this updated guide, I will walk you through the steps to copy files from Windows to Linux using easy-to-follow steps.
I will show you two ways to copy files from windows to Linux
- Using command line with pscp
- Using GUI FTP utility.
Copy File from Windows To Linux Using PSCP
It is not always that you will need to copy a file from Windows to Linux or vice versa.
But at times when you are automating things or trying to achieve some copy functionality using a script, it is good to have a utility to do that.
Here is where
pscp comes into play. Using
pscp you can copy the file to/from windows and Linux.
Step 1: Download pscp.exe from here. Select the appropriate package.
Step 2: copy the pscp.exe executable to the system32 directory of your windows machine. This folder normally exists in
Step 3: Open Windows PowerShell and use the following command to verify if pscp is accessible from the path.
You should see the following output.
Step 4: Use the following format to copy the single file from Windows to the Linux box.
pscp -pw password C:\Users\Admin\Desktop\test.txt \ [email protected]:/home/vagrant
Here is the explanation of the command.
-pwfor the password.
passwordwith the Linux user password.
C:\Users\Admin\Desktop\test.txtrepresents the path of the file that has to be copied to the Linux system.
192.168.33.10is the IP of the Linux server.
/home/vagrantis the user-accessible path in the Linux system to copy the file.
If you want to copy all the files in a directory to Linux, you need to add a start to the folder. eg.
folder\*. An example is shown below.
pscp -pw password C:\Users\Admin\Desktop\folder\* \ [email protected]:/home/vagrant
If you are using Linux private keys for authentication, you can use
-i flag instead of
-pw followed by the path to the
If your key file is in
pem format, you can use the puttygen command to convert it to ppk. See this ec2 server guide for the
Info: Learn Linux & Windows administration from Pluralsight with its 10 days free account
For Linux Private key-based authentication, the command looks like below.
pscp -i /path/to/key.ppk C:\Users\Admin\Desktop\test.txt \ [email protected]:/home/vagrant
Copy File From Linux To Windows Using PSCP
You can use pscp to copy files from Linux to windows. use the following command format for the same.
pscp -pw password [email protected]:/path/to/file \ C:\Users\Admin\Desktop\
The above command will copy the file in Linux from the specified path to the Windows desktop.
Copy File from Windows To Linux Using FTP GUI
If you are not familiar with the Windows command line, you can use an FTP tool like Filezilla.
This tool is really helpful if you are working with Web Hosting providers to upload your website files from your local workstation.
You can download Filezilla from here –> FileZilla Download.
After download, install Filzill as you install any other windows software.
After installation, open the Filezilla app and enter the remote Linux server details as shown below. It will connect to the server and shows the remote server files in the file explorer.
To upload a file, all you have to do is do a right-click and click upload, as shown in the image below. The file will get uploaded to the remote path, which is opened in the Filezilla explorer. You can also change the remote path from Filezilla.
I have shown two best and recommended ways to transfer files from Windows to Linux and vice versa.
If you face any issues while copying files, please drop the issues as a comment. I will look into it.