Moving from Windows to Linux and need to copy data across? Use these tricks to transfer or share files from Windows to Linux.
Copying data from a Windows PC to Linux—or in the other direction—can seem intimidating at first. After all, it’s something that seems like it should be simple but turns out to be difficult.
In truth, sharing files from Windows to Linux is easy, but only if you know how to do it. Ready to find out? Here’s everything you need to know about how to transfer files from Windows to Linux and back again.
4 Ways to Transfer Files From Windows to Linux
If you want to move data between Windows and Linux operating systems, it’s easier than you think. We’ve compiled four ways for you to do this:
- Securely copy files via SSH
- Windows to Linux file transfer with FTP
- Share data using sync software
- Use shared folders in your Linux virtual machine
With each of these methods, you’ll be able to easily (and, in some cases, effortlessly) carry out Linux to Windows or Windows to Linux file transfer.
Let’s look at them in turn and find out which one suits you best.
1. Copy Files Between Windows and Linux via SSH
With SSH enabled on your Linux device, you can send data via the command line from one computer to another. For this to work, however, you will need to set up an SSH server on your Linux machine.
Start by opening a terminal and updating and upgrading the OS.
sudo apt update
sudo apt upgrade
Once complete, install the SSH server. The OpenSSH server is a good option.
sudo apt install openssh-server
Wait while it installs. To check at any time if the OpenSSH server is running, use:
sudo service ssh status
To transfer data from Windows, use an SSH client like PuTTY. This needs the PSCP (secure copy client) tool to download to your Windows system to run alongside PuTTY. Find both on the PuTTY downloads page.
Download: PuTTY
Note that while PuTTY will need installing, PSCP won’t. Instead, save the downloaded pscp.exe file in the root of the Windows C:\ drive or else set it up as an environment variable. You’ll also need to confirm the IP address of the Linux device. Check in the Linux terminal with:
hostname -I
With a connection established, you can transfer a file from Windows to Linux like this:
c:\pscp c:\some\path\to\a\file.txt user@remoteIP:\home\user\some\path\newname.txt
You’ll be prompted for your password for the Linux computer before the transfer commences.
Want to copy files from Linux to Windows in the same SSH session? This command will download the specified file to the current directory:
c:\pscp user@remoteIP:\home\user\some\file.txt .
Note the lone period at the end, which you must include, or the transfer will not work.
2. How to Transfer Files From Linux to Windows Using FTP
You can also use a file transfer protocol (FTP) application with SSH support. Transferring files via SFTP in a mouse-driven user interface is arguably easier than relying on typed commands.
Again, an SSH server must be running on the Linux machine before you start. You should also ensure you have installed an FTP app on Windows, like FileZilla, which has SFTP support.
Download: FileZilla
To use this method, run FileZilla, then:
- Open File > Site Manager
- Create a New Site
- Set the Protocol to SFTP
- Add the target IP address in Host
- Specify a username and password
- Set the Logon Type to Normal
- Click Connect when ready
You can then use the FTP app to move files from Windows to Linux and back using drag and drop.
Another option you should consider is a file-syncing program. These are typically cross-platform and use an encrypted key to manage the connection between devices.
All you need to do is install the app, nominate a sync folder, then create the key. Set this up on the second PC, and your data will then sync. Two good options are available for this:
- Resilio Sync: Formerly known as BitTorrent Sync, Resilio is available on almost any platform you can think of. There is a paid version, but the free option is enough for syncing two devices
- Syncthing: For Linux, Windows, macOS, and Android, this Resilio Sync alternative offers a similar feature without the paid component
4. How to Transfer Files From Windows to a Linux Virtual Machine
Instead of running a separate PC, it’s common to run Linux or Windows in a virtual machine (VM). But is there a way to transfer files between Windows and Linux when one is installed in a VM?
Fortunately, yes. With VirtualBox, you can create a virtual shared directory for data syncing.
If you’re running Windows in a VM on Linux (or vice versa), VirtualBox is already set up for sharing. Ensure you have the Guest Additions installed on your virtual machine before proceeding.
In the VirtualBox manager, select the VM, then:
- Choose Start > Headless Start (or with the VM running, Devices > Shared Folders)
- Once running, right-click the VM and select Settings > Shared Folders
- Select Machine Folders
- Click the + symbol on the right (or right-click and select Add Shared Folder)
- Browse the Folder Path and find the directory you want to use
- Set a name (if necessary), then OK
- Use the Auto-mount checkbox to ensure the share is available whenever the VM runs
- Click OK again to confirm and exit
When you reboot the VM, the share will be ready to swap data between the host PC and the guest operating system.
There is another option for sharing files between Windows and Linux PCs. However, creating a shared file on one or both systems and then accessing it across a network is unreliable at best.
Sharing Files Between Windows and Linux Is Easy
Whether you’re new to Linux or you find Windows unfamiliar, sharing data between them is easier than you think. Now that you know how to transfer files from Windows to Linux and vice versa, we’d recommend you try all the methods we’ve mentioned above and work out which one you’re most comfortable with.
If you’re syncing data to Linux, there’s a good chance you’re switching from Windows. Don’t worry—it’s easier than you think.
Home > How to Copy File from Windows to Linux Using SSH [2 Methods]
Want to copy and transfer files and folders securely from Windows to Linux using SSH? SCP (Secure Copy) can be the finest tool in this case. It actually works within SSH (Secure Shell) protocol and demonstrates a secure and high-speed data transfer from one computer to another over an unsecured network. In this guide, I will describe how to copy file from Windows to Linux over SSH using the SCP tool on Windows 10. Explore and follow the guide manually.
Key Takeaways
- Learning about SSH protocol.
- Learning how to copy files from Windows to Linux using PowerShell and SCP/SSH.
Requirements
- Users must have Windows 10 setup.
- Users’ Linux PC must be running an OpenSSH server.
Process Flow Chart
[Distro & Windows Used Throughout the Tutorial: Ubuntu 22.04.2 LTS & Windows 10]
Downloads
To download WinSCP for file transfer follow the link: Winscp.net
If you want to make the SCP tool work on your Windows, there must be a running OpenSSH server on your Linux system to where you want to transfer files and folders. Here is how to get the SSH server installed:
sudo apt install openssh-server
EXPLANATION
- sudo: Super User DO.
- apt install: Advanced package utility.
- openssh-server: Open source secure shell server permits remote users to access server.
As everything is set up now, I’ll cover two methods to copy and transfer files from Windows to Linux securely in this guide.
You can go through the Comparative Analysis of Methods to know about the pros and cons of the used methods.
Method 01: Using PowerShell to Copy File from Windows to Linux Using SSH
By default, SCP is built into Windows 10 PowerShell. You don’t have to install it separately. You can use SCP in PowerShell directly by following the steps below:
Steps to Follow >
❶ Open Windows File explorer and copy the file location you want to copy from Windows to Linux.
➋ Now, open PowerShell and write cd and paste the copied file location like below and hit ENTER.
cd C:\Users\User\Downloads
EXPLANATION
- cd: Navigates to assigned folder.
- C:\Users\User\Downloads: The location of the file/folder.
➌ Then, use the SCP command like the following syntax:
SCP colors.txt [email protected]:/home/nadiba/Desktop
EXPLANATION
- SCP: It allows secure file transfer between the hosts on a network.
- colors.txt: The file you want to transfer. Here, I want to transfer the ‘colors.txt’ file.
- [email protected]:/home/nadiba/Desktop: Replace ‘nadiba’ with your Linux username, replace ‘192.168.231.128’ with your LAN IP address or hostname, replace ‘/home/nadiba/Desktop’ with the folder where you want to transfer the file.
➍ Open Files on your Ubuntu and go to home>nadiba>Desktop to check the copied file.You can see from the above image that the file ‘colors.txt’ has been transferred to the Linux system.
Read More: How to Share Files between Linux and Windows
Method 02: Using SFTP Client to Copy File from Windows to Linux Using SSH
For Windows, there are several SFTP clients available like WinSCP, FileZilla, Cyberduck, PuTTY etc. Among them, WinSCP can be a better option to transfer files from Windows to Linux when you want to avoid syntax complexity. It provides a convenient GUI interface. Here’s how to use WinSCP to copy files:
Steps to Follow >
❶ Download and install WinSCP on your PC. You will find the download link above in the Downloads section.
❷ Now, launch it and you will see a Login window.In the File protocol section, replace SFTP with SCP. Also, enter the hostname, username, password and click Save. Then, there will prompt a new window like the following image:Press OK and then click Login.❸ Now, there will prompt a window asking ‘Continue connecting to an unknown server and add its host key to a cache?’. Click Yes.➍ Then, put your user password again for authentication.➎ Open File explorer on Windows, browse a file and drag the file into WinSCP’s window. The file will be shared instantly to the remote Linux PC.
Here, I want to share an image file named ‘samba.png’. So, I dragged it into the WinSCP window and you can see that the file is transferred to Linux.
Read More: How to Share Files between Linux and Windows Dual Boot [3 Methods]
Comparative Analysis of Methods
When it comes to copying files from Windows to Linux over SSH, you can use either PowerShell or SFTP client. Let’s make a comparative analysis between these two methods:
Methods | Pros | Cons |
---|---|---|
Method 1 |
|
|
Method 2 |
|
|
Overall, both methods are preferable with their individual capabilities. It’s your choice to select one which meets up your needs and preferences.
Conclusion
While working on Windows, transferring files to Linux machines is quite a common task. In the article, I have introduced different methods to copy files from Windows to Linux through SSH protocol. Hope you’ll be benefited from this guide.
People Also Ask
Does SCP work on Windows?
Yes, you can run SCP via PuTTY (An open source terminal emulator which provides secure connection).
Does PowerShell have SCP?
PowerShell does not have SCP by default. Check ‘Enable Secure Copy Protocol Support’ on the connection tab. Then, click Save Changes and restart.
Does SCP work on Internet?
Using SCP requires only a running ssh server and client SCP on the internet works fine.
Does SCP have a limit?
SCP’s policy document;’s maximum size is 5120 bytes.
Related Articles
- How to Configure NFS Server in Linux? [5 Steps]
- How to Access Shared Folder in Ubuntu [2 Methods]
- How to Install and Configure Samba Server in Ubuntu? [4 Steps]
- How to Install, Configure and Connect Samba Client on Ubuntu
- Install, Configure and Connect Samba on Ubuntu Using GUI
- How to Access Samba Share from Windows [2 Methods]
Hello, This is Nadiba Rahman, currently working as a Linux Content Developer Executive at SOFTEKO. I have completed my graduation with a bachelor’s degree in Electronics & Telecommunication Engineering from Rajshahi University of Engineering & Technology (RUET).I am quite passionate about crafting. I really adore exploring and learning new things which always helps me to think transparently. And this curiosity led me to pursue knowledge about Linux. My goal is to portray Linux-based practical problems and share them with you. Read Full Bio
This article about How to Transfer Files from Windows to Linux Server provides a detailed explanation of the PuTTY Secure Copy (PSCP), how to use it and its syntax. In fact, how to transfer files between a Windows and a Linux Machine is simple procedure without using WinSCP (Windows Secure Copy) tool will demonstrate here.
SCP is a combination of RCP (remote copy) and SSH (Secure Shell) and runs on Port 22. File transfers are handled by RCP, and authentication and encryption are handled by SSH, so SCP can be considered a combination of RCP and SSH
PuTTY Secure Copy (PSCP):
The SCP command allows files to be transferred between computers securely and effortlessly using the SSH service. PSCP is a program that transfers files with encryption between servers and another remote computer.
An SSH connection is used to transfer files securely between computers using PSCP, the PuTTY Secure Copy client. This protocol is used to transfer files to servers and supports encryption and authentication. Data in transit is kept confidential using Secure Shell (SSH) mechanisms. We need to check firewalls before starting the procedure.
Winscp is used to transfer files between the remote systems, whereas putty is used to connect to systems in command line mode.
Step 1: Using Windows Explorer, find the path to the Putty installation on your Windows device. In my windows server location is C:\Program Files\PuTTY
Location of putty files in windows machine
In order to get the pop-up, hold the shift key + right click you can see Open PowerShell Windows here option as shown above.
NOTE: In some windows server operating system option will be like Open Command Prompt windows here.
Step 2: Select Open PowerShell Windows here option and execute the below command in order to Copy the file from the Linux machine to the windows machine.
pscp.exe [email protected]:/linux_date/operational C:\Security_windows
Explanation of the syntax
- xxx.xxx.xxx.xx indicates the IP Address of the Linux Machine
- linux_date indicates the directory in Linux Machine
- operational indicates the target file is to be copy into the windows machine
- Security_windows is the folder in windows machine (destination folder)
Transfer files between Linux to Windows Machine
3. Files are copied successfully from Linux to Windows Machine as shown above.
Transfer files from Windows to Linux
The same procedure as explained in the above steps only difference is syntax because the file needs to be copy from the Windows machine to Linux Machine
pscp.exe C:\Security_windows\usersdate [email protected]:/linux_date
- C:\Security_windows\usersdate: usersdate is file in windows machine
- xxx.xxx.xxx.xx: IP Address of Linux Machine
- linux_date: directory in Linux Machine
Transfer the files from Linux and Windows Machine
Files are copied successfully from Windows Machine to Linux.
In my previous article discussed about Enable Multiple RDP Sessions on Windows Server operating system.
conclusion:
Copying data from one device to another is often considered as a big challenge. Transferring data from one operating system to another, such as Windows to Linux or the other way around, can be even more tricky. While transferring data across platforms, such as between Windows and Linux, can be challenging, with the right tools and some flexibility, the process can be surprisingly simple as shown above.
In this blog discussed about How to transfer files between a Windows and a Linux Machine this will be useful when deploying your application to Linux machine and copy the file between them. Please leave a message if you encounter any problems while copying files.
Introduction
When using Linux machines, either as a Virtual Private Server or as a Virtual Machine on your local computer, one of the major problems that people encounter is to transfer their files from their host (main) machine to the Linux machine. This problem is generally resolved by a file transfer protocol client such as WinSCP and FileZilla. In this article, we shall learn how to transfer files and folders from Microsoft Windows to a Linux machine using the WinSCP software. WinSCP is a File Transfer Protocol client for Microsoft Windows. As said, it uses the FTP (File Transfer Protocol) and SFTP (Secure File Transfer Protocol) protocols to transfer files from a Windows machine to any other machine (Linux in this case).
Prerequisites
- Windows machine with WinSCP installed.
- Linux machine connected to the internet.
Transferring Files/Folders from Windows to Linux using WinSCP
Once you have the prerequisites, you can follow the following steps to transfer files and folders using WinSCP.
Step 1: Get the Public IP Address of your Linux Machine
The first thing we need is the IP address of the target Linux machine. To get this, open a terminal and then, type the curl command in the terminal:
curl ipinfo.io/ip
Here, we are sending an HTTP request to the ipinfo.io/ip website which is a utility that returns the Public IP address of the client machine. Thus, you will get an IPv4 address on your machine.
Getting the public IP Address
Step 2: Allowing FTP in the firewall
Now, if you are using a firewall, it is important to allow the FTP in your firewall otherwise the WinSCP will not be able to connect to your machine. Generally, Linux machines use the ufw firewall. To allow the FTP service, type the following command in your Linux terminal.
ufw allow ftp
On success, you will see a message like the following:
Allowing FTP in the firewall.
If you use some other firewall manager, use its corresponding commands to allow FTP.
Step 3: Connecting WinSCP to the Linux machine using the IP address
Now, open the WinSCP application on your windows machine. You will get a login prompt as follows:
WinSCP Login Window
Here, we will leave the File protocol to SFTP (Secure File Transfer Protocol), which means it will use port 22 for connecting to our Linux machine.
- In the hostname, enter the Public IP address of the Linux machine found in step 1.
- Then, enter the username which you want to connect using the machine and its password.
- (Optional) You can also save the connection settings if you desire.
Once all the fields are filled, click on ‘Login‘ and you will be given a warning about whether you want to connect to the unknown target machine or not, like the following:
Warning for new connections.
Allow it by clicking on the ‘yes‘ button and it will be added to your trusted sources, which means that the next time you connect to this same machine, you will not be given such a warning again. Now, you have an active connection between the Windows and the target Linux machine. The WinSCP will now show you files from both your host machine and the remote Linux machine as well like below:
WinSCP Window after successful connection
On the left split window, we have the host machine and on the right, we have the remote Linux machine.
Step 4: Copying Files and Folders from host to remote machine.
Now, to transfer any files/folders all you have to do is copy them from the right window and paste it in the left window.
To copy, right-click on a file or folder and click on copy to clipboard. We are taking the dummy_tranfer.txt file and dummy_folder directory for copying in this example.
Copying file to Clipboard
Then, in the remote machine, navigate to the folder you want to save the file/folder and right-click in it then, choose ‘Paste From Clipboard‘. In this example, we are copying the files into the /home/transfers/ directory in our Linux machine but, you are free to choose any directory However, be cautious of using the same later in the article as well.
Pasting the file/folder into the remote machine
The contents of the transfers folder will now look like:
Contents after successful transfer of files and folders.
We have now successfully learned how to transfer files and folders from Windows to a Linux machine using WinSCP.
Note: There is no difference between transferring a file and a folder. You copy and paste them both in the same manner as shown above.
Step 5: Verifying the copied files
Now, to verify whether we have the files in our Linux machine, open a terminal on your Linux machine and type the following ls command:
ls <path to the directory used in WinSCP transfer (Step 4)>
This will give us the contents of the /home/transfers directory in which we copied our files.
Verifying Transfer
As we can see, we have got the folder and the file we copied to our Linux machine.
Step 6: Closing the connection
Once you are done transferring files/folders, always close the connection properly as an unclosed connection might lead to unexpected errors sometimes. To close the connection, navigate to the Tabs option in the toolbar then, choose Disconnect Session. Now, the session is successfully logged out.
Closing the connection to a remote server.
Conclusion
In this article, we learned how to fetch the public IP address of a Linux machine and then, use that IP address to set up a login session in WinSCP using the SFTP protocol to transfer files and folders. Then, we ended the tutorial by learning how to close the connection. The WinSCP provides other protocols, such as FTP, SCP, etc. to transfer files. It depends on the user’s need to choose the appropriate one. However, in most general cases you would use the SFTP protocol, which is also recommended due to security reasons.
A great many people are confused about how to transfer files from Windows to Linux. If you are also trying to figure it out, this post of MiniTool is worth reading. It introduces 5 feasible ways for copying files from Windows to Linux.
Have you ever made a switch between different operating systems like Windows to Linux? If the answer is yes, you may wonder how to transfer files from Windows to Linux. Copying files from Windows to Linux or back again won’t be difficult via the following 5 ways. Here you can try them in order or choose one that works best for you.
# 1. Transfer Files from Windows to Linux via SSH
SSH (Secure Shell) is a remote administration protocol that allows you to control and modify your servers over the internet. It’s also a cryptographic network protocol that enables you to use network services safely even through an unsecured network.
With SSH enabled on your computers, you can transfer file from Windows to Linux via the command line. Here’s how to do that:
Step 1. Update the Linux OS on your computer.
1. On your Linux device, open a terminal window/command line by using the Ctrl + Alt + T or Ctrl + Alt + F2 key combinations.
2. In the terminal window, execute the following command to update your local repositories.
sudo apt-get update
Step 2. Install the OpenSSH server.
1. You can install the SSH server via the OpenSSH server, which can eliminate all potential threats to your data. Run the following command in the terminal window to install the OpenSSH server.
sudo apt install openssh-server
2. Wait for the installation to complete. Then you can run the following command to check if the OpenSSH server is installed properly.
sudo service ssh status
Step 3. Install an SSH client like PuTTY on Windows.
PuTTY is an SSH client that can help you copy a file from Linux to Windows freely between different networks. To run alongside PuTTY, you need to get the PSCP (secure copy client) tool on Windows.
Tips:
You just need to manually install PuTTY on Windows., but he PSCP doesn’t have to install and you can save the downloaded pscp.exe file on the C drive.
1. Click here to open the PuTTY download page, select a version according to your system and click on the blue link to download it.
2. Double-click the PuTTY install to run it and click on Next, save the exe file in the root of the Windows C: drive and click on Next.
3. Click on Install to start installing PuTTY on your Windows PC.
Step 4. Start copying files from Windows to Linux.
- Confirm the IP address of your Linux device by running the hostname -I command in the terminal window.
- Make sure you have a connection established. Then you can copy files from Windows to Linux using the following code.
Tips:
Make sure to replace remoteIP: with the IP address of your Linux device.
c:pscp c:
omepathtoafile.txt user@remoteIP:homeuser
omepath
ewname.txt
- Before the transfer, you need to input your Linux computer password for copying files from Windows to Linux.
- If you want to copy a specific file like file.txt in Windows to a directory like temp in Linux, you can run the following command.
C:Program FilesPuTTY>pscp Usersuserfile.txt user@IP:/temp
- If you want to copy file from Linux to Windows, you can reverse the command.
C:Program FilesPuTTY>pscp user@IP:/temp/file.txt Usersuser
# 2. Transfer Files from Windows to Linux via FTP
FTP (File Transfer Protocol) is a standard network protocol designed to transfer computer files between clients and servers on a computer network. This tool can help you transfer a file from Windows to Linux without typing any commands.
Before you do, you need to install an SFTP-supported app on Windows like FileZilla and make sure your Linux server is running for this method. Then you can follow the steps below to copy Windows files to Linux.
Step 1. Launch the FileZilla app on Windows, and then select File > Site Manager from the upper left corner.
Step 2. Select the site folder and click on New Site and change the Protocol to SFTP.
Step 3. Input the target IP address of your Linux server next to the Host box.
Step 4. Add your username and password, and change the Logon Type to Normal.
Step 5. Once done, click on Connect.
Now, you can use the FTP app for transferring files from Windows to Linux back using drag and drop.
# 3. Transfer Files from Windows to Linux via Virtual Machine
If you are running Linux in a VM on Windows or vice versa, you can transfer file from Windows to Linux by running one of your systems on the VM. The program can be used to create a virtual shared directory for data syncing.
To do this work, you need to have a VM app like Oracle VM VirtualBox installed on your PC. Here’s how to transfer files to Linux from Windows via the VM.
Step 1. Launch the VM VirtualBox app on your PC, and then select Start > Headless Start.
Step 2. When the app is running, right-click the VM and select Settings > Shared Folder > Machine Folders.
Step 3. Click on the “+” icon at the upper right corner and select Add Shared Folder.
Step 4. Select the Folder Path and locate the directory that you want to transfer.
Step 5. Set the Folder Name if necessary, and tick the checkbox next to Auto-mount to ensure the shared folder is available when you run the VM.
Step 6. Click on OK to save the change and exit.
Step 7. Restart your Virtual Machine and the shared folder will be ready to transfer data between your host PC and the Guest OS. Then you can copy a file from Linux to Windows or vice versa.
# 4. Transfer Files from Windows to Linux via Sync Software
You can consider using a Sync software app like Resilio and SyncThing for transferring files from Windows to Linux. This tool can be used to manage the connection between two operating systems or devices with an encrypted key.
With the Sync software, all thing you need to do is install the app on the first PC, choose a sync folder, and create the encrypted key. Then set up this app on the second PC and your data can be synced between Windows and Linux.
In addition, you can create a shared network folder on one or both systems and then copy Windows files to Linux or vice versa across a network. That’s to say, this method will allow you to share the same files/folders in both Windows and Linux simultaneously. Well, the operation may fail if your network is unreliable, but it’s having a try.
Step 1. On Windows, right-click the network connection icon from the system tray and select Open Network & Internet Settings > Network and Sharing Center.
Step 2. Select Change advanced sharing settings and enable the following 2 options, and click on Save Changes.
- Turn on network discovery
- Turn on file and printer sharing
Step 3. Navigate to the target that you want to transfer a file from Windows to Linux, right-click the folder, and select Properties.
Step 4. In the Properties window, go to the Sharing tab and click on Advanced Sharing, and select the checkbox for Share this folder. Also, you can click on Permissions to manage the permissions.
Step 5. Click on Apply and then on OK to save the changes.
Step 6. To copy files from Windows to Linux, simply open the file explorer of your Linux device and select Network. Then locate the Windows-hosted folder and start copying files from Windows to Linux.
If you want to transfer a folder from Linux to Windows, you can use a tool that can emulate the Windows protocols in Linux, allowing you to share files with Windows.
Further Reading: Do you want to manage your partition and disk on Windows effectively? MiniTool Partition Wizard is a good choice that can help you extend/resize/delete partition, convert a disk to MBR/GPT, migrate OS, etc.