Open In App

How To Transfer File From Linux To Windows?

Last Updated : 30 Nov, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

There are many reasons why many people need to transfer files across Linux to Windows OS, be it for work, or for platform compatibility. Rest assured, this kind of file transfer is relatively effortless to do so. It is well-known that transferring files from Linux to Windows is scary and vice versa.

How-To-Transfer-File-From-Linux-To-Windows

In this article, we’ll go through how to send files across Linux to Windows and vice versa easily.

Method 1: Using SSH Transfer Protocol with PuTTy

One of the easiest methods to transfer files from Linux (Ubuntu) to Windows OS is to use PuTTy pscp (PuTTy Secure Copy Client). PuTTy is used to create a client-server link to connect both platforms via a Wireless connection. PuTTy is a free open-source SSH client which works across multiple platforms and has become a mode for easy file transfers across platforms.

Step 1: To start with Install SSH if you don’t have it in your Linux OS. Follow the Command prompt codes to do so.

Ubuntu/Debian OS

sudo apt update
sudo apt install ssh-server
sudo service ssh start

Red Hat and other Linux-based OS

sudo yum install openssh-server
sudo systemctl start sshd

Step 2: Install PuTTy in your system if you don’t have it. Otherwise, ignore this step. If you want to install PuTTy in your Linux OS, follow the command prompt lines below:

For Ubuntu and Linux Mint OS

For Ubuntu, you’ll need to access the universal repository available and install PuTTy there. Hence, there are additional commands to access the universal repository below:

sudo add-apt-repository universe
sudo apt update
sudo apt install putty

For Debian OS

sudo apt-get putty

For Arch Linux OS

sudo pacman -S putty

For RHEL, Fedora, CentOS, AlmaLinux

sudo dnf install putty

For others

sudo yum install putty

Now you have successfully installed PuTTy in your Linux OS. Now, you can use it for file transfer from Linux to Windows and vice-versa. Similarly, you can also download PuTTy in Windows OS.

Step 3: Transfer files across different OS.

It becomes easy using PuTTy pscp (PuTTy Secure Copy Client). Simply provide the source path and the destination paths for file transfer and the files would be transfered.

In this case, the IP address of a sample Linux system is 192.168.0.18. Let’s see the skeletal structure of the command prompt line we’ll need to type:

[path_where_pscp_is_downloaded]>pscp user@[host:source destination]

Example 1:

For example, assume that PuTTy pscp is downloaded on the Windows Program Files directory and we’ll need to transfer files from Linux to Windows OS to send a file called “a.txt”. Follow the command prompt code below:

C:\Program Files\PuTTY>pscp user@192.168.0.18:/tmp/a.txt \Users\<username>

Example 2:

For vice-versa, to store the file in a new directory follow the code below:

Important: Check whether the directory exists or else, you’ll get an error. You can use the following command to create a new directory:

mkdir <directory_name>

C:\Program Files\PuTTY>pscp \Users\<username>\a.txt user@192.168.0.18:/<directory_name>

Now, you’ve successfully transferred files from Linux OS to Windows OS and vice-versa.

Method 2: Using FTP with FileZilla or Shared Network Folders

Another simple method used for file transfer is using FTP (File Transfer Protocol). This is the easiest method since this involves no coding/ command lines. Let’s see how to do that. If you don’t have FileZilla, check out How to install FileZilla on Windows. After installing FileZilla, follow the following steps.

Step 1: Open FileZilla in your Windows OS.

Step 2: Navigate to “File” section and select “Site Manager” after opening FileZilla.

Step 3: Change the protocol to SFTP.

Step 4: Type your Linux Address in the Host coloumn, which in this case is 192.168.0.18.

Step 5: Under the General section, go to “Logon Type” and select “Normal” as shown in the image below:

FTP-FileZilla-tutorial

Step 6: Enter the Username and Password of the Linux OS machine.

Step 7: After all the 6 steps are done, click “Connect”.

Now you’ve created a client-server connection with SFTP between Linux and Windows OS. After the connection is created, it is simply a matter of dragging and dropping files between the platforms mentioned earlier.

Method 3: Using SMB Protocol

One other way of transferring files from Linux to Windows is by connecting both OS systems using the SMB (Server Message Block) protocol. SMB can be used both in Windows and Linux to initiate a connection to share and transfer files.

Step 1: Use/ Install Samba in Linux

Samba is an open-source software which provides clients with file and print services in a Windows-based network. This software supports connections between Windows systems and can be used to transfer files.

To install Samba, type the following commands in your Linux terminal.

sudo apt install samba -y

After successfully installing samba-client, check its status by typing the command:

systemctl status smbd

Step 2: Create a shared directory

When transferring files from Linux to Windows, create a shared directory which will be used by both Linux and Windows OS. Follow the command below to see how to do so.

mkdir <directory_of_your_choice>

Give administrative permission using the chmod command.

chmod 777 <directory_of_your_choice>

Note: There are several numbers in chmod which are used to give specific permissions. They are

  • 777everyone can read, write and edit (full access)
  • 755Owners can read, write and execute, and group users can read and edit the file.
  • 644Only owners can read, write and execute the files. The other people included by the owner can only view the file.

Step 3: Create a new user specifically for file-sharing

While sharing files, create a new user whose account will be used for the sharing/ transfer of files. The command for this is

useradd <username>

Step 4: Give an SMB password for the user

To facilitate SMB protocol under the user, you must create an SMB password by executing the command below

smbpasswd -a <username>

Then type out the password in the terminal.

Step 5: Edit the config file in samba using any editor (or nano)

Type out the command below

sudo nano /etc/samba/smb.conf

After opening the file, scroll to the bottom of the file and add the following lines.

path = <directory_of_your_choice>
valid users = <username>
read only = no
browsable = yes
public = yes
writable = yes
browsable = yes

Save and exit the file, then check if everything was edited and saved successfully by running the following command.

testparm

Step 6: Find the IP address of your Linux System

Using ifconfig, find the IP address of your Linux system.

ifconfig wlo1

Your IP address will be shown below:

Terminal-ip-address

Step 7: Connect to the network from the Windows side

Launch the “Run” program by pressing the “Windows button” and “R”. Then type the IP address of the Linux system you got from the previous step. Type the IP address with two slashes before it.

run-dialogue

This will open the Linux-shared folders. Now you can view it and transfer files in between.

Conclusion

There is an increase in the number of users and developers opting for Linux OS currently as there is a greater need for these people to transfer files from their previously used Windows system. Due to the age of both OS, there have been several ways founded by many people to make file transfers across these OS much easier and painless.

Also Read

FAQs to Transfer File From Linux To Windows

1. How to switch from Windows to Linux seamlessly?

Many users consider switching from Windows to Linux OS because it is open-source and free. Windows OS costs money and with new technological advances, there is little difference between Windows and Linux. It is recommended to initially convert your current PC to a dual OS system with both Windows and Linux (provided you have 36 GB free). After getting used to the UI of Linux, you can make the transition to Linux OS. The most popular Linux OS is Ubuntu.

2. Can you transfer files from Linux to Windows VM?

Yes, you can transfer files from a Linux OS to a Windows VM. It can be done using a USB stick.

3. Can I transfer files between Linux systems?

Yes, you can transfer files between Linux systems using FTP (File Transfer Protocol) and also define the file type of the file being sent (ASCII or Binary).



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads