Copy Files Between Windows and Linux Using Command Line

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 file to/from windows and Linux. In this guide, I will go through the steps in doing the same.

Copy File from Windows To Linux

1. Download pscp.exe from here

2. copy the pscp.exe executable to the system32 directory of your windows machine. This folder normally exists in C:\Windows\System32 path.

3. Open PowerShell and use the following command to verify if pscp is accessible from the path.


4. Use the following format to copy the file to Linux box.

pscp -pw password C:\Users\Admin\Desktop\test.txt  \

-pw for the password.

replace password with the Linux user password.

C:\Users\Admin\Desktop\test.txt represents the path of the file that has to be copied to the Linux system. is the IP of the Linux server.

/home/vagrant is the user accessible path in the Linux system to copy the file.

If you are using private keys for authentications, you can use -i flag instead of -pw followed by the path to the .ppk file. If your key file is in pem format, you can use the puttygen command to convert it to ppk.

For key based authentication, the command looks like below.

pscp -i /path/to/key.ppk C:\Users\Admin\Desktop\test.txt \

Copy File Form Linux To Windows

You can use pscp to copy files from Linux to windows. use the following command format for the same.

pscp -pw password user@ \

The above command will copy the file in Linux from the specified path to the windows desktop.


Pin It on Pinterest

Share This