Linux Commands

How to Copy Files from Linux to Windows

You may have copied numerous files and directories from one location to another within a single operating system. Have you ever attempted copying a file from one operating system to another? If you have tried, you’ve most likely failed. This guide will demonstrate how to copy a file from one operating system to another. Within this article, we will be discussing a unique and straightforward method to transfer or make a duplicate of a file/folder from Linux to Windows or vice versa. So, you need to update your system first. For updation, try to use the “apt” package within the update instruction with sudo rights. Add your sudo account password, and the system will get updated in a few seconds.

$ sudo apt update

After a successful update, upgrade your system if it is required. Use the below-shown upgrade command using the “apt” package.

$ sudo apt upgrade

Install SSH Server:

Within some cases, we may require the ssh-server to transfer files between two different operating systems, i.e., Linux and windows. Therefore, we need first to install an ssh server on our Ubuntu 20.04 system. For installation, use the below-shown “apt” command.

$ sudo apt install openssh-server

Tap “y” upon being asked to continue the installation of ssh-server on your system.

To check whether the ssh service is currently active and enabled on our Linux operating system or not, you have to use the systemctl instruction in the shell. Use the word “status” at the last of this instruction. The output shows that the service is currently active on our system.

$ sudo service ssh status

Install Samba Tool:

You must first ensure that the “samba” tool is installed on your machine before using any approach. If not, try using the apt installation command below with the name “samba.” Add your sudo account password, and the execution will be started.

$ sudo apt install samba

Tap “y” to continue installing and processing the “samba” package on our Ubuntu 20.04 Linux operating system.

After its successful installation, you have to create a samba user, i.e., “test” using the usermod instruction. After that, add the smbpasswd command on the shell to create a password for this account. Add password on asked one after another as shown below.2

$ sudo useradd –M –N –g sambashare test
$ sudo smbpasswd –a test

From Windows to Linux:

Before going up with the copy files between Linux and Windows systems, you need to find out the ip address of the Windows operating system. To find out the ip address, open your windows command prompt application and execute the “ipconfig” command on it. It will display the different WLAN settings of your windows system. The first adapter WLAN setting will show you your system’s “ip address.” Note it down for now.

$ ifconfig

Now, within the windows “Local Disk©” directory, you have to create a new folder to be shared. As you can see from the image beneath, we have named “Share.” We need to update the privileges of this folder to allow remote users access. So, right-click on it and hover over the “Give access to” option. It will expand further, and you have to select the “Specific people..” option, as per the below-shown output image.

The below screen “Network access” will be opened. As there is only one owner of this folder right now, you have to add a new user here.

So, we have added the user “Everyone” and assigned it to read/write privileges for this folder. Tap on the “Share” button to continue applying the changes.

Your folder is now shared, and anyone can access it. You can also see the file path shown in the below image. Tap on the “Done” button to exit.

Open the file explorer within the Ubuntu 20.04 system and tap on the “Other locations.” You will check the “Connect to server” option at the bottom of the screen. At the text bar, write the simple URL command of the format shown below to get the shared file from the Windows system. Tap on the “Connect” button to do so.

$ Smb://ip-address-of-windows/foldername

A dialogue shown below will appear. You have to add a registered user’s name, domain name, and password for the Ubuntu 20.04 system. Tap on the connect button after that.

The folder “Share” from the windows system will be opened in your Ubuntu 20.04 system, as shown below. We have added a new text file from our Ubuntu system to this folder.

On checking the Windows “Share” folder, we have got to know that the file from Ubuntu’s “Share” folder is also here, as demonstrated below.

From Linux to Windows:

To copy a file from Linux to windows, you have to create a new folder, i.e., “Share,” in the home directory, as shown below. Right-click on it and tap on “Properties.”

Expand the ” Local Network Share ” section within the Properties dialogue that appeared on your screen, expand the “Local Network Share” section. Check to mark the “Share this Folder” option and the “Allow others to create and delete” option. Tap on the below “Share” button and close it.

Now, your folder has a “share” sign on it.

Open the “run” application in windows and run the IP address URL with a double backslash sign, i.e.,//ip-address. The “Share” folder will be opened on your Windows “Network” file explorer.

Conclusion:

This was all about transferring or copying a file from Linux to the Windows operating system. For more clearance, we have tried to copy the file from Windows to Linux first. We have used the Ubuntu 20.04 Linux operating system and Windows 10 to copy files. All steps elaborated in this article will be helpful for all types of users.

About the author

Omar Farooq

Hello Readers, I am Omar and I have been writing technical articles from last decade. You can check out my writing pieces.