How do I access the WSL Linux file system from Windows?

I found that static files served from a Rails application running in /home/pupeno/projectx take more or less half as much time than the ones served from /mnt/c/Users/pupeno/projectx. It's almost acceptable. I tried webrick and puma (as well as passenger and unicorn, which don't work yet).

So, if I'm going to host my source code in /home/pupeno, how do I access from Windows applications such as RubyMine?

For the record, this is the application being served from the Windows file system:

enter image description here

and this is the Linux file system:

enter image description here

1

6 Answers

PM for Windows Command-Line here:

Thus far, accessing Linux files from Windows has been unsupported. To understand why, please read this post:

However, as of Windows 10 build 1903 (March 2019), we (finally!) exposed your distros' filesystems to Windows!

To learn more, please read this post:

enter image description here

Look forward to hearing how you get on with this feature. If you find any problems, please file issues on the WSL GitHub repo here: .

1

WSL mounts Windows partitions under /mnt. For example, you can modify files in c:\work on the mounted Windows filesystem by referencing them as /mnt/c/work.

Windows apps (cmd, file manager, etc), can access files in WSL in read-only mode by prepending with %LocalAppData%\lxss. Copying a file from the Windows filesystem to the WSL directories renders it unreadable, with a cryptic general I/O error. Files created in %LocalAppData%\lxss from Windows are not visible to WSL. Files created from WSL can be modified in Windows, and the modified file can subsequently be accessed by WSL.

2

On Windows 10 Creators Update, I use SFTP NetDrive to mount the WSL filesystem into windows as as a network drive.

There are some Window sshFS ports that'll achieve the same thing.

You'll need to start the ssh daemon via sudo service ssh start.

1

With Windows 10 version 1903 and later, WSL filesystems are available in Windows via the \\wsl$ mount. Either browse there manually or launch explorer.exe from a WSL path:

$ cd /home/me $ explorer.exe . 

If you have an existing WSL installation and you upgrade to Windows 1903 you may find that the \\wsl$ mount doesn't work. Some users have found that disabling and re-enabling WSL fixes the issue.

In PowerShell:

Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux # Reboot when prompted Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux # Reboot when prompted 

Disabling and re-enabling WSL didn't seem to harm my existing Ubuntu installation but it's probably worth backing up anything you want to save just in case.

fire the CLI command explorer.exe \\wsl$ in Windows powershell/cmd

You can easily access, read and write files from WSL Linux file system to Windows and vice-versa by simply navigating to the file location :

C:\Users\\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState\rootfs

Hope this helped you!!

9

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like