Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 374
pupeno Avatar asked Jan 06 '17 20:01

pupeno


People also ask

Can you access WSL files from Windows?

One of the benefits of WSL is being able to access your files via both Windows and Linux apps or tools. Using your mounted drives, you can edit code in, for example, C:\dev\myproj\ using Visual Studio / or VS Code, and build/test that code in Linux by accessing the same files via /mnt/c/dev/myproj .

How do I access the WSL file folder?

Whenever you are in a directory in WSL that you would like to access from File Explorer, simply type: $ explorer.exe . $ explorer.exe .

How do I access WSL2 folder in Windows?

Access Linux Files from Windows You can access WSL2 Linux files from the network path \\wsl$\ . Enter it in the File Explorer address bar or any file open dialog. Here, <yourname> is the username you defined during installation. It's best to set this as the starting folder for the distro in Windows Terminal.

How can I access Linux files from Windows?

Press Win + E keys to open the File Explorer, and then map your Linux home folder or directory on Windows. Click on Tools at the top menu and select Map network drive. Select the drive letter from the drop-down menu and click on Browse to select the folder that you want to mount.


3 Answers

PM for Windows Command-Line here:

Thus far, accessing Linux files from Windows has been unsupported. To understand why, please read this post: https://blogs.msdn.microsoft.com/commandline/2016/11/17/do-not-change-linux-files-using-windows-apps-and-tools/

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

To learn more, please read this post: https://blogs.msdn.microsoft.com/commandline/2019/02/15/whats-new-for-wsl-in-windows-10-version-1903/

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: https://github.com/microsoft/wsl.

like image 175
Rich Turner Avatar answered Sep 16 '22 20:09

Rich Turner


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.

like image 31
Mike Slinn Avatar answered Sep 18 '22 20:09

Mike Slinn


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.

like image 44
mliang2 Avatar answered Sep 19 '22 20:09

mliang2