copy files from linux to windows

How to Copy Files from Linux to Windows

We often copy files from one location to another on the same system. But sometimes you may need to copy files from Linux to Windows. In this article, we will learn how to copy files from Linux to Windows. You can also use these steps to copy folders across systems with different OS. We will also learn how to copy files from Windows to Linux.


How to Copy Files from Linux to Windows

Here are the steps to copy files from Ubuntu Linux to Windows.

1. Update System

First we need to update Linux system. Open terminal and run the following command for this purpose.

$ sudo apt update

2. Install SSH Server

Most Linux systems have SSH server pre-installed. If that is not the case with you, run the following command to install SSH server.

$ sudo apt install openssh-server

If you see any prompts during installation, just enter ‘y’ to proceed further.

After SSH server is installed, you can check its status with the following command.

$ sudo service ssh status

3. Install Samba

Samba is a Windows interoperability suite for Linux/Unix systems. It allows Linux/Unix systems to communicate with Windows systems easily. So we need to install this software before proceeding further. Run the following command for this purpose.

$ sudo apt install samba

You may be asked for sudo or account password to begin installation, enter it to proceed further. If you see any prompts during installation enter ‘y’ to proceed.

4. Create Samba User

Once you have installed Samba software on your system, you need to create a user for this software, using usermod command. You need to also enter the password. Here is the command to create a test user ‘test’ and set its password.

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

5. Find IP Address of Windows

Next, you need to find the IP address of Windows system. Open command prompt on your Windows system and run ifconfig command to get its IP address.

$ ifconfig

The above command will show a lot of different information. The first adapter WLAN setting will display IP address.

5. Create Windows Folder

Next, within Local Disk folder (C:) you need to create a new folder ‘Share’. Next we need to update the privileges of this folder to allow remote access. To do this, right click the folder, and hover ‘Give Access to’. It will expand to show you a menu. Click ‘Specific people …’ as shown below.

It will open a window with a list of available users. Select the user ‘Everyone’ to give remote access. Select ‘Read/Write’ option from dropdown under Permission Level and click Share button.

Now this folder is shared and remote users can access it. Click Done to close the window.

6. Access Shared Folder from Ubuntu

Open File Explorer in Ubuntu, click ‘Other Locations’, check ‘Connect to Server’ at the bottom. Enter the Samba URL to your Windows system in text bar and click Connect button. Here is the format of Samba URL.

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

Here is a sample screenshot for your reference.

You will see a dialog box asking for your Samba username and password. Enter them and click Connect button.

You will see Share folder’s contents in File Explorer. You can right click them and click Copy to copy them.

7. Copy Files from Linux to Windows

If you want to copy files & folders from Linux to Windows you need to enable remote access to Linux folders. Create a new folder ‘Share’ in your Linux system. Right Click to see context menu and click ‘Properties’.

You will see a dialog box. Expand ‘Local Network Share’ and check ‘Share this folder’ option and ‘Allow others to create and delete’ option. Click Share button and close it.

You will see the share icon added to the folder’s icon.

To access this folder from Windows system, open run application in your Windows system. Enter the IP address of your Linux system as //ip-address and click Ok.

It will open the Share folder in Windows Network File Explorer.

In this article, we have learnt how to copy files from Windows to Linux and vice versa.

Also read:

How to Set Process Priority in Linux
How to Change Default MySQL Data Directory in Linux
How to Fix firewall-cmd command not found
How to Protect Hard and Soft Links in Linux
How to Run Shell Script on Another Server

Leave a Reply

Your email address will not be published. Required fields are marked *