How to Transfer and Share Files Between Windows and 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:

  1. Securely copy files via SSH
  2. Windows to Linux file transfer with FTP
  3. Share data using sync software
  4. 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:

  1. Open File > Site Manager
  2. Create a New Site
  3. Set the Protocol to SFTP
  4. Add the target IP address in Host
  5. Specify a username and password
  6. Set the Logon Type to Normal
  7. Click Connect when ready
Share files between Linux and Windows using FTP

You can then use the FTP app to move files from Windows to Linux and back using drag and drop.

3. Share Files Between Linux and Windows With Resilio Sync

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:

  1. 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
  2. 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:

  1. Choose Start > Headless Start (or with the VM running, Devices > Shared Folders)
    Enable a headless start for your VM

  2. Once running, right-click the VM and select Settings > Shared Folders
  3. Select Machine Folders
  4. Click the + symbol on the right (or right-click and select Add Shared Folder)
  5. Browse the Folder Path and find the directory you want to use
  6. Set a name (if necessary), then OK
    Share files between Windows and Linux in a virtual machine

  7. Use the Auto-mount checkbox to ensure the share is available whenever the VM runs
  8. 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.

Can You Move a File From Windows to Linux Using a Network Share?

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.


Source link

Leave a Reply

%d bloggers like this: