Windows Subsystem for Linux is great feature for running Linux programs and trying out multiplatform ASP.NET Core applications under Linux. It is possible to browse and edit files on disks mounted to WSL but it didn’t worked with files on WSL “disks”. With next version of Windows it will change.
Why this feature? Windows guys usually doesn’t feel very comfortable using shell window tools and editors popular in Linux world. When editing configuration or code files we want to use our favorite tools. In no means I want to say that Windows guys on Linux should avoid Linux tooling. No, go and get familiar what Linux has to offer. There are many great tools available.
Accessing WSL files
Next version of Windows solves the problem and files in Windows Subsystem for Linux will be available in Windows Explorer. It’s not hack but fully supported scenario.
Trick is simple. When WSL starts there will be new “network drive” available. It has name derived from the name of Linux distro running on WSL. I have Ubuntu 18.04 installed on my development box. Here’s how I can see its file system from Windows Explorer.
Those who make more use of WSL probably want more.
Mapping WSL disk as network drive
We can map WSL “disk” as network drive through Windows Explorer and for this we must use same path as before.
Settings on screenshot above were enough for me to get my Ubuntu “disk” mapped as U: drive.
This drive mappings works well on my machine even when my Ubuntu is closed and not in use.
Those who build and test multiplatform .NET Core and ASP.NET Core applications on Windows Subsystem for Linux can now easily access WSL files through Windows Explorer. It’s also possible to create and edit configuration files and all other files one needs on WSL. We can map WSL file system as network drive to access it easily.
View Comments (4)
How can I start properly WSL commandline in the mapped drive?
Please give me more details about what you want to do.
Opening Windows' explorer in any directory on C:\ gives me an option to immediately open Linux shell in that directory by right clicking there and choosing option "Open Linux shell here". It will open WSL terminal for me in that directory (/mnt/c/whatever).
When I try to do same in the mapped network directory, the terminal is being open in my home directory, instead of the currently viewed directory (U:\home\whatever).
The NEW wsl$ feature is wonderful ; but limited and restricted because of the usual linux/nix ownership/permission problems.
This feature uses the default user. If your default user is root you have no problems; otherwise you are sol.
The default user can only access and edit user-space files in the "home"/user folder.
Therefore this feature with the default user cannot edit and change "configuration files"