Transferring Files Between WSL Instance and Windows Host Machine: A Step-by-Step Guide

Posted by

How to Copy Files Between WSL Instance and Windows Host Machine

How to Copy Files Between WSL Instance and Windows Host Machine

If you are using a Windows Subsystem for Linux (WSL) instance on your Windows machine, you may need to copy files between your WSL instance and your Windows host machine. This can be done easily using a few simple commands.

Copying Files from WSL to Windows

To copy files from your WSL instance to your Windows host machine, you can use the following command:

cp /path/to/file/in/wsl /mnt/c/Users/YourUsername/destination

Replace “/path/to/file/in/wsl” with the path to the file you want to copy from your WSL instance, and “mnt/c/Users/YourUsername/destination” with the path where you want to copy the file on your Windows host machine.

Copying Files from Windows to WSL

To copy files from your Windows host machine to your WSL instance, you can use the following command:

cp /mnt/c/Users/YourUsername/file/on/windows /path/to/destination/in/wsl

Replace “/mnt/c/Users/YourUsername/file/on/windows” with the path to the file you want to copy from your Windows host machine, and “/path/to/destination/in/wsl” with the path where you want to copy the file in your WSL instance.

Using Windows File Explorer

You can also use Windows File Explorer to copy files between your WSL instance and Windows host machine. Simply open File Explorer and navigate to “Network” in the left sidebar. You should see your WSL instance listed under “WSL.” You can now easily drag and drop files between your WSL instance and Windows host machine.

With these simple commands and methods, you can easily copy files between your WSL instance and Windows host machine without any hassle.

0 0 votes
Article Rating
3 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
@sbaidya1023
4 months ago

I cannot delete a file in /usr/local/bin in ubuntu in WSL using file explorer. Can one please help?

@sitaroartworks
4 months ago

Thanks, very helpful.

@gmo3501
4 months ago

Thanks a lot!