How to copy files from windows to Linux using SCP command

Today we will explore, how to copy files from Windows to Linux using the SCP command (the command must be used in lowercase, we are using upper case in this document for better readability).

How to access the PowerShell scp command?

Here we use the command scp to copy the file from Windows to the Linux server. The latest version of Windows PowerShell has the SCP command build-in. For example, if you open Powershell from your desktop and run the command scp, it will display the usage, please refer to the below example:

The scp command in PowerShell

To copy a file or a number of files, we need to specify more details to the command as parameters (or command line arguments), as shown in the usage.

Simply put, you would need the below information handy:

  • The source file(s) path (Windows local file path)
  • source file names and extensions (optional)
  • Remote server name (your Linux server)
  • Remote server username (and have the remote server password)
  • Specific path of the remote location, where you want to copy the file(s) using the SCP command.

Let us jump into a practical example now.

Windows to Linux file copy using scp – Example 1

providing the local-filename, remote server details as:


Full example:

PS C:\Users\dev\codetryout\demo> scp my-file1.txt devops@codetryout:
devops@codetryout's password:
my-file1.txt                                                                          100% 5681     1.9MB/s   00:00

You have successfully copied the file my-file.txt to the remote server codetryout!

Note the ending column in the command line, which specifies the scp command to copy the file to the remote user’s home directory. That is typically the first directory when you log in (such as in my case, /home/devops).

copying file to Linux from Windows

We have tested this on Windows 11 Powershell, and the remote server is Ubuntu 20.04.3

FAQ: What is the message – The authenticity of host … cant be established

If you are copying the file(s) for the first time, or ssh to the server for the first time, there will be a message as shown below.

The authenticity of host 'codetryout (' can't be established.
ECDSA key fingerprint is SHA256:0M8vQMz8T5j6A7xeni1ex6d825RKLRy/h6pvKggaNUU.
Are you sure you want to continue connecting (yes/no/[fingerprint])?

Just type in yes if prompted and enter to continue.