Transferring a document from your Linux machine to a Windows computer can be done using a network share or a USB drive. If you’re wondering how to copy file from linux to windows, you’ve come to the right place. This guide covers multiple methods, from simple USB transfers to advanced command-line tools, so you can choose what works best for your setup.
Whether you’re a developer moving code or a regular user sharing photos, moving files between these two operating systems is easier than you think. Let’s walk through each method step by step.
How To Copy File From Linux To Windows Using A USB Drive
This is the most straightforward method. You don’t need any network setup or special software. Just a USB flash drive formatted correctly.
Step 1: Format The USB Drive For Compatibility
Windows uses NTFS or FAT32 file systems. Linux can read both, but FAT32 is the safest bet for small files. If your file is larger than 4GB, use NTFS or exFAT.
- Plug the USB drive into your Linux machine.
- Open the “Disks” utility or use the terminal command
lsblkto find your drive. - Format it to NTFS or FAT32 using the GUI or command line.
Step 2: Copy The File To The USB Drive
Once the drive is mounted, simply drag and drop your file to the USB folder. Or use the terminal:
cp /path/to/your/file /media/username/USB_NAME/
Step 3: Safely Eject And Use On Windows
Right-click the USB icon and select “Eject” or use sudo umount /dev/sdb1 in terminal. Then plug it into your Windows PC. The file should appear in File Explorer.
How To Copy File From Linux To Windows Using Samba (Network Share)
Samba lets Linux share folders with Windows over your local network. This is great for frequent transfers without moving a USB stick around.
Installing And Configuring Samba On Linux
First, install Samba if it’s not already installed. On Ubuntu or Debian:
sudo apt update
sudo apt install samba
Then create a shared folder:
- Create a folder:
mkdir ~/shared - Edit the Samba config file:
sudo nano /etc/samba/smb.conf - Add these lines at the bottom:
[SharedFolder]
path = /home/yourusername/shared
available = yes
valid users = yourusername
read only = no
browsable = yes
public = yes
writable = yes
Setting Up A Samba Password
Run this command to set a Samba password for your user:
sudo smbpasswd -a yourusername
Then restart Samba:
sudo systemctl restart smbd
Accessing The Share From Windows
On your Windows machine, open File Explorer. In the address bar, type:
\\LINUX_IP_ADDRESS\SharedFolder
You’ll be prompted for your Linux username and Samba password. Once connected, you can copy files back and forth like any normal folder.
How To Copy File From Linux To Windows Using SCP (SSH)
If you prefer the command line and have SSH access to your Windows machine, SCP is fast and secure. You’ll need an SSH server on Windows, like OpenSSH.
Setting Up SSH On Windows
Windows 10 and 11 have OpenSSH available as an optional feature. Go to Settings > Apps > Optional Features > Add a feature. Search for “OpenSSH Server” and install it.
Then start the service:
Start-Service sshd
Set-Service -Name sshd -StartupType 'Automatic'
Using SCP From Linux To Copy A File
On your Linux machine, open a terminal and use this syntax:
scp /path/to/local/file username@windows_ip:/path/to/destination/
For example:
scp ~/Documents/report.txt john@192.168.1.100:C:\Users\John\Desktop\
You’ll be asked for your Windows password. The file will copy over securely.
How To Copy File From Linux To Windows Using Rsync Over SSH
Rsync is like SCP but better for large files or syncing folders. It only transfers changes, saving time and bandwidth.
Installing Rsync On Both Systems
Linux usually has rsync pre-installed. On Windows, you can use it through WSL (Windows Subsystem for Linux) or install a tool like cwRsync.
For simplicity, use WSL on Windows:
- Install WSL from the Microsoft Store.
- Open a WSL terminal and install rsync:
sudo apt install rsync
Running Rsync From Linux
On your Linux machine, run:
rsync -avz /path/to/local/file username@windows_ip:/path/to/destination/
The -a flag preserves permissions, -v gives verbose output, and -z compresses data during transfer.
How To Copy File From Linux To Windows Using FTP
FTP is older but still works. You’ll need an FTP server on Windows and an FTP client on Linux.
Setting Up An FTP Server On Windows
You can use FileZilla Server or enable IIS FTP. For a quick setup, try FileZilla Server:
- Download and install FileZilla Server from the official site.
- Set up a user account and specify a home folder.
- Start the server and note the IP address.
Using FTP From Linux
Open a terminal and use the ftp command:
ftp windows_ip
Enter your username and password. Then use put to upload a file:
put /path/to/local/file
Or use a GUI client like FileZilla on Linux for a more visual experience.
How To Copy File From Linux To Windows Using Cloud Storage
If both machines have internet access, cloud storage is the simplest method. No network configuration needed.
Using Google Drive, Dropbox, Or OneDrive
Install the cloud client on both Linux and Windows. On Linux, you can use the web interface or a CLI tool like gdrive for Google Drive.
Simply upload the file from Linux, then download it on Windows. This method works well for files under 2GB (free tier limits vary).
How To Copy File From Linux To Windows Using A Python HTTP Server
This is a quick hack for transferring files without installing anything. Python’s built-in HTTP server can share a file over your local network.
Starting The Server On Linux
Navigate to the folder containing your file and run:
python3 -m http.server 8000
This starts a web server on port 8000. Your file will be listed in the browser.
Downloading On Windows
On Windows, open a web browser and go to:
http://linux_ip:8000
Click the file to download it. This method is unencrypted, so only use it on trusted networks.
Common Issues And Troubleshooting
Sometimes things don’t work as expected. Here are some frequent problems and fixes.
Permission Denied Errors
If you get “Permission denied” when using SCP or Samba, check that the destination folder on Windows is writable. Also ensure your Linux user has read access to the source file.
Firewall Blocking Connections
Windows Firewall may block Samba or SSH traffic. Temporarily disable it to test, then create an inbound rule for the specific port (445 for Samba, 22 for SSH).
USB Drive Not Recognized
If Windows doesn’t see the USB drive, it might be formatted with ext4 or another Linux-only file system. Reformat it to NTFS or FAT32.
Frequently Asked Questions
Can I Copy Files From Linux To Windows Without A Network?
Yes, use a USB drive formatted with NTFS or FAT32. This is the most reliable offline method.
What Is The Fastest Way To Copy Large Files From Linux To Windows?
For large files over a local network, use rsync over SSH or Samba. Both are efficient and fast.
Do I Need To Install Software On Windows To Use SCP?
Yes, you need an SSH server on Windows. Enable OpenSSH Server in Windows Optional Features.
Can I Use A Crossover Cable To Copy Files Directly?
Yes, connect both machines with an Ethernet cable and assign static IPs. Then use SCP or Samba as described above.
Is It Safe To Use FTP For File Transfers?
FTP sends data in plain text. For sensitive files, use SCP or SFTP instead.
Conclusion
Now you know multiple ways to handle how to copy file from linux to windows. Choose the method that fits your situation: USB for one-time transfers, Samba for regular network sharing, SCP for secure command-line transfers, or cloud storage for simplicity. Each method has its strengths, so experiment and find what works best for you. With these steps, moving files between Linux and Windows becomes a quick and painless task.