How to get wsl files 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

wsl$ mount point did not work for me so well, it has multiple issues, and many Windows applications fail because they see it as a network drive. For my usecase, it is Rclone what helped to solve the problem to properly mount Linux filesystem so it behaves without any issues, practically the same way as a local disk.

It is free and open source. It works with sftp remote filesystems (like sshfs), so it can mount network drives both on Linux and Windows (running sshd service).

Example command how to run it, assuming remote point «server» is already configured and rclone.exe is in PATH environment variable:

rclone mount server:/ Z: --file-perms=0777 --track-renames --track-renames-strategy=modtime,leaf --metadata --vfs-cache-mode=full --sftp-disable-hashcheck --volname drive_name

For the first time, you need to configure new remote point by running:

rclone config

To find out location of the config file you have just created, run:

rclone config file

Also, you may need to install WinFsp first, if not already intalled. The best thing about it, everything just works the same way like with local disk (assuming if you provide --vfs-cache-mode=writes or --vfs-cache-mode=full option, since without it, many applications will fail to work correctly, please read the documentation to understand why). Option --file-perms=0777 is necessary to allow running .exe files. Even though --vfs-cache-mode=writes may be enough for most applications, but —vfs-cache-mode=full is important for good performance with large files. For the same reason --track-renames-strategy is limited to only modtime and leaf strategies, because if haenter code heresh strategy is used, it will be obviously slow with large files, and --sftp-disable-hashcheck is necessary to prevent rclone from running md5sum, otherwise it will run it even when trying to read a file.

To register Rclone as a system service, edit and run the following command (do not run as is, please see below how you need to edit it first):

New-Service -Name Rclone -BinaryPathName 'C:Program FilesRclonerclone.exe mount server:/ Z: --vfs-cache-mode=full --track-renames --track-renames-strategy=modtime,leaf --metadata --volname drive_name --config="C:Program FilesRclonerclone.conf" --log-file="C:Program FilesRclonerclone.txt" --file-perms=0777 --sftp-disable-hashcheck --no-console'

Obviously, you need to replace «server:/» with your actual remote point name and path, also replace drive_name with any name you like, and of cource you may need to edit paths to rclone.conf, rclone.log and rclone.exe, if you installed it in a different location.

Note: in my case running as a system service caused some permission issues (for example, when trying to save Excel files), and I did not figured out why yet, so I ended up creating startup .bat file to run Rclone as a user, since it works perfectly this way. I will update this answer if and when I figure out how to make running as a service to work as good as running as a user.

Even Windows software which does not like network drives, just works with RClone drives. All is needed, is to setup sshd in the remote system (which in this case is not really a remote syset, but in WSL distribution installed on the same PC). This how to setup sshd in WSL distribution: https://www.hanselman.com/blog/how-to-ssh-into-wsl2-on-windows-10-from-an-external-machine. And here is how to make WSL IP address static: https://github.com/ocroz/wsl2-boot, so you can have sshd running always at the same IP address.

I’ve been getting a few questions from Windows users about accessing WSL files in Windows and vice versa. I was originally going to wait with this for the next labs, but since this might actually make things a little clearer for some, I’ll just post the information here instead. If anything’s unclear, just wait for the second lab and I’ll probably be able to explain things better in person.


The WSL distributables (i.e. Ubuntu) are kind of like another machine running within your computer. It just features a Unix command-line interface (that’s the terminal, i.e. the bash shell), so the development tools and experiences are pretty limited. You can run vim, nano, or even emacs (might need to be installed) in the terminal to edit your files, but if you want to use a full-fledged IDE you’ll normally have to edit the files on the Windows side and then transfer them over to the Linux environment in WSL.

When we start working with Python, R and jflap, you can probably just solve the exercises on Windows, since you don’t need Linux to write Python or R code. Of course, you can always install python3 in Ubuntu, but you won’t have access to an IDE (unless you follow the guide in the last part of this post).

Accessing your WSL files in Windows

If you are using WSL 1, this should probably work fine most of the time. However, if you are using WSL2, it probably won’t. WSL2 doesn’t like it when we edit files in both Linux WSL and in Windows. WSL1 doesn’t like it either, but it’s possible to do, and I’ve tried so myself many times now without issues.

To access your Linux files in Windows, open the Ubuntu terminal and type explorer.exe . (include the punctuation mark). This will open the linux directory in Windows Explorer, with the WSL prefix “wsl$Ubuntu-18.04homeyour-username”.

Now, you’ll notice that Windows treats your Linux environment as a second network. This is because, as I’ve stated earlier, the Linux environment is completely separate from the Windows environment and transferring files between these environments is very similar to transferring files between computer networks. I always recommend that you copy the file you want over to a Windows folder before editing it, so that you won’t mess up the original if the file gets corrupted.

PS: To copy the file, run cp [filename] [destination], like this: console cp file.txt /backup/new_file.txt

Accessing your Windows files in the WSL terminal

Similarly, you can also open your Windows files in the Linux environment. Just use the cd command to navigate to your WSL root folder, then navigate into the mnt folder to access your C: drive. See the example below for more details. As you can see, I managed to access my Documents folder. Make sure to enter your own username when you try this yourself.

Accessing your Windows files in WSL

I recommend you to use the cp command to copy the files you need from Windows to your Linux environment, so that if anything should get corrupted you’re not going to mess up the original file.

Working in WSL with VScode

VScode is a full-fledged IDE from Microsoft, which has very recently released support for editing Linux files remotely. This means that you can open VScode from the Ubuntu terminal, run it in Windows, but edit the files in Linux while also being able to access the Linux terminal and viewing pathnames and home directory correctly. I’ve tried it out today, and… it just works!

So if you insist on using an IDE to edit your Linux files directly, even though you won’t really need to in this course, you can do it by installing the Remote — WSL extension for VScode. See the documentation and guides here.

VSCode WSL-remote demo VScode editor with WSL-remote enabled

This question answers how to access Windows files from Ubuntu Bash, but how can I do the opposite?

Specifically, I need to access my SSH key from Windows which is located at /home/mark/.ssh/id_rsa under Bash.

Community's user avatar

asked Aug 8, 2016 at 3:35

mpen's user avatar

6

\wsl$Ubuntuhomeuserwhatever 

In the explorer or the Run widget (Cmd+R). Works like a normal network share and it’s safe to manipulate files.

You can also map it to a drive or folder, just as any other network share.

Note: This is a new feature implemented in Windows 10 build 18342

answered Oct 24, 2019 at 8:44

runlevel0's user avatar

runlevel0runlevel0

8926 silver badges10 bronze badges

6

Yes but is not recommended to manipulate that folder from the windows explorer. If you want to copy, move, edit or erase files from the lxss folder you need to do it inside bash with command line tools.
Only files that are on /mnt/* are really manipulable from the windows explorer.

answered Aug 8, 2016 at 11:12

onoma's user avatar

onomaonoma

2411 silver badge5 bronze badges

3

Found it by searching my entire C drive. Files are here:

C:Users<username>AppDataLocallxss

e.g., my SSH key is here:

C:UsersMarkAppDataLocallxsshomemark.sshid_rsa

answered Aug 8, 2016 at 3:45

mpen's user avatar

mpenmpen

11.7k16 gold badges54 silver badges68 bronze badges

3

In powershell, use

cd ${env:appdata}..localpackagescanonical*localstaterootfs

then

ls

returns the same list of folders as

ls / 

within bash on WSL.

answered Feb 27, 2019 at 12:10

masterxilo's user avatar

masterxilomasterxilo

4786 silver badges7 bronze badges

1

If you open Windows Explorer e type the path \wsl$ it will list all your installed Linux distributions.

answered Jun 18, 2020 at 2:53

neves's user avatar

nevesneves

4492 gold badges6 silver badges11 bronze badges

3

As has been mentioned above by [onoma] files in WSL directories have attributes that would be gone if one manipulates it using explorer or text editor run under Windows system. The solution could be to start ssh-server in WSL (there might be a reinstall necessary) listening on localhost and then mounting WSL filesystem as a drive using, for example, win-sshfs or you can just use Bitvise SSH client to connect over ssh and manipulate files by sftp window. The topic has been partially discussed here: How can I SSH into “Bash on Ubuntu on Windows 10”?

answered Sep 2, 2017 at 19:52

Shamar's user avatar

0

I finally made a way to open explorer (and vscode) with actual correct folder context from inside WSL:
https://github.com/andymule/wslwin

For example, after you install this, in linux (WSL) you would just cd /home/mark/.ssh/ and type explorer, and it would open windows explorer at that location, whatever it is.

EDIT: this feature is being officially supported in WSL now, and you should no longer use my scripts

answered Jan 19, 2019 at 20:06

andymule's user avatar

subst L: $env:LOCALAPPDATAlxss (for powershell)

or subst L: %LocalAppData%lxss (from cmd)

This puts your Linux-subsystem filesystem-root / on your L: drive.

You could also map just your home directory, or just whack %LocalAppData%lxss in an explorer window. Just don’t try browsing L:mntc or your brain might explode.

answered Jun 17, 2017 at 7:03

Cheezmeister's user avatar

CheezmeisterCheezmeister

8271 gold badge8 silver badges12 bronze badges

1

I just discovered you can run powershell.exe from linux and your linux console becomes a PowerShell console at the current directory. This is the best of both worlds as you never have to leave your linux console… which is where I spend most of my time. You can then type exit to get back into linux world.

answered Nov 17, 2021 at 22:19

Ryan Wheale's user avatar

Im 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»

answered Aug 1, 2017 at 20:45

mliang2's user avatar

2

This worked for me using Powershell

cd  Microsoft.PowerShell.CoreFileSystem::\wsl$Ubuntu-20.04homeusername

answered Jul 19, 2021 at 0:15

adammendoza's user avatar

From RUN (WindowsKey + R) you can type \wsl$ and it will give you all your wsl installations.
This applies for WSL2

answered Nov 20, 2021 at 13:44

Philipos D.'s user avatar

Windows 10 version 1903 «April 2019 Update» comes with a number of interesting changes and improvements made to the WSL feature. These include additional distros in the Store, the ability to browse WSL files from File Exporer, and more.

The ability to run Linux natively in Windows 10 is provided by the WSL feature. WSL stands for Windows Subsystem for Linux, which initially, was limited to Ubuntu only. Modern versions of WSL allow installing and running multiple Linux distros from Microsoft Store.

Linux Distros Microsoft Store Windows 10

After enabling WSL, you can install various Linux versions from the Store. You can use the following links:

  1. Ubuntu
  2. openSUSE Leap
  3. SUSE Linux Enterprise Server
  4. Kali Linux for WSL
  5. Debian GNU/Linux

and more.

With Windows 10 version 1903 «April 2019 Update» you can easily access all the files in your Linux distros from Windows. As of this writing, this feature is implemented in Windows 10 build 18836. It is on its way to the 19h1 branch, so we will see it with the next build. Here is how it can be done.

To access WSL Linux Files from Windows 10, do the following.

  1. Enable the WSL feature.
  2. Install some distro, e.g. Ubuntu, and start it.
  3. While in a directory on a Linux FS, type explorer ..
  4. This will open a File Explorer window, located inside of your Linux distro.

Access Linux Files In Windows 10

From there you can access whatever Linux files you like, just like you would any other file through File explorer. This includes operations such as: dragging files back and forth to other locations, copy and paste, and even using custom context menu entries added by Notepad++, VSCode, and other software.

File Explorer shows the distro files as a virtual network share under the path \wsl$<running_distro_name>.

WSL Network Share

The WSL team is actively investigating ways to improve the discoverability of Linux files inside of File Explorer. The progress of their work can already be seen in Windows 10 Build 18836 that shows WSL/Linux File System in File Explorer.

Access Linux Files in Command Line

In addition to File Explorer, you can use the classic Command Prompt, and PowerShell tools to access your Linux files. Similarly, you need to navigate to \wsl${distro name} where {distro name} is the name of a running distro.

WSL In PowerShell

Known issues

This is a new feature, and some pieces of it may not work perfectly. Here are some known issues that we want to make you aware of when using this feature:

  • As of right now, the distros files will only be accessible from Windows when the distro is running. Developer are going to add support for non-running distros in a future update.
    Since the 9P file server runs inside of each distro, it is only accessible when that distro is running. The team is looking into ways to help resolve this.
  • Accessing Linux files is treated the same as accessing a network resource, and any rules for accessing network resources will still apply
    e.g: When using CMD, cd \wsl$Ubuntuhome will not work (as CMD does not support UNC paths as current directories), however copy \wsl$Ubuntuhomesomefile.txt C:dev will work
  • The old rules still apply, you should NOT access your Linux files inside of the AppData folder!
    If you try to access your Linux files through your AppData folder, you are bypassing using the 9P server, which means that you will not have access to your Linux files, and you could possibly corrupt your Linux distro.

Note: A 9P server is a server that contains protocols that support Linux metadata, including permissions. The WSL init daemon now includes a 9P server. There is a Windows service and driver that acts as the client and talks to the 9P server (which is running inside of a WSL instance). Client and server communicate over AF_UNIX sockets, since WSL allows interop between a Windows application and a Linux application using AF_UNIX.

Source: Microsoft

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won’t take a lot from you, but it will help us grow. Thanks for your support!

title description keywords ms.date ms.topic

Working across file systems

Learn about the considerations and interop commands available when working across Windows and Linux file systems with WSL.

wsl, Linux, Windows, file systems, interop, across directories, mnt

09/27/2021

article

Working across Windows and Linux file systems

There are a number of considerations to keep in mind when working between Windows and Linux file systems. We have outlined a few of them for you in this guide, including some examples of interoperability support for mixing Windows and Linux-based commands.

File storage and performance across file systems

We recommend against working across operating systems with your files, unless you have a specific reason for doing so. For the fastest performance speed, store your files in the WSL file system if you are working in a Linux command line (Ubuntu, OpenSUSE, etc). If you’re working in a Windows command line (PowerShell, Command Prompt), store your files in the Windows file system.

For example, when storing your WSL project files:

  • Use the Linux file system root directory: \wsl$Ubuntuhome<user name>Project
  • Not the Windows file system root directory: /mnt/c/Users/<user name>/Project$ or C:Users<user name>Project

When you see /mnt/ in the file path of a WSL command line, it means that you are working from a mounted drive. So the Windows file system C:/ drive (C:Users<user name>Project) will look like this when mounted in a WSL command line: /mnt/c/Users/<user name>/Project$. It is possible to store your project files on a mounted drive, but your performance speed will improve if you store them directly on the \wsl$ drive.

View your current directory in Windows File Explorer

You can view the directory where your files are stored by opening the Windows File Explorer from the command line, using:

Alternatively, you can also use the command: powershell.exe /c start . Be sure to add the period at the end of the command to open the current directory.

To view all of your available Linux distributions and their root file systems in Windows File explorer, in the address bar enter: \wsl$

View project files in Windows File Explorer

Filename and directory case sensitivity

Case sensitivity determines whether uppercase (FOO.txt) and lowercase (foo.txt) letters are handled as distinct (case-sensitive) or equivalent (case-insensitive) in a file name or directory. Windows and Linux file systems handle case sensitivity in different ways — Windows is case-insensitive and Linux is case-sensitive. Learn more about how to adjust case sensitivity, particularly when mounting disks with WSL, in the Adjust case sensitivity how-to article.

Interoperability between Windows and Linux commands

Windows and Linux tools and commands can be used interchangeably with WSL.

  • Run Windows tools (ie. notepad.exe) from a Linux command line (ie. Ubuntu).
  • Run Linux tools (ie. grep) from a Windows command line (ie. PowerShell).
  • Share environment variables between Linux and Windows. (Build 17063+)

Run Linux tools from a Windows command line

Run Linux binaries from the Windows Command Prompt (CMD) or PowerShell using wsl <command> (or wsl.exe <command>).

For example:

C:temp> wsl ls -la
<- contents of C:temp ->

Binaries invoked in this way:

  • Use the same working directory as the current CMD or PowerShell prompt.
  • Run as the WSL default user.
  • Have the same Windows administrative rights as the calling process and terminal.

The Linux command following wsl (or wsl.exe) is handled like any command run in WSL. Things such as sudo, piping, and file redirection work.

Example using sudo to update your default Linux distribution:

C:temp> wsl sudo apt-get update

Your default Linux distribution user name will be listed after running this command and you will be asked for your password. After entering your password correctly, your distribution will download updates.

Mixing Linux and Windows commands

Here are a few examples of mixing Linux and Windows commands using PowerShell.

To use the Linux command ls -la to list files and the PowerShell command findstr to filter the results for words containing «git», combine the commands:

wsl ls -la | findstr "git"

To use the PowerShell command dir to list files and the Linux command grep to filter the results for words containing «git», combine the commands:

C:temp> dir | wsl grep git

To use the Linux command ls -la to list files and the PowerShell command > out.txt to print that list to a text file named «out.txt», combine the commands:

C:temp> wsl ls -la > out.txt

The commands passed into wsl.exe are forwarded to the WSL process without modification. File paths must be specified in the WSL format.

To use the Linux command ls -la to list files in the /proc/cpuinfo Linux file system path, using PowerShell:

C:temp> wsl ls -la /proc/cpuinfo

To use the Linux command ls -la to list files in the C:Program Files Windows file system path, using PowerShell:

C:temp> wsl ls -la "/mnt/c/Program Files"

Run Windows tools from Linux

WSL can run Windows tools directly from the WSL command line using [tool-name].exe. For example, notepad.exe.

Applications run this way have the following properties:

  • Retain the working directory as the WSL command prompt (for the most part — exceptions are explained below).
  • Have the same permission rights as the WSL process.
  • Run as the active Windows user.
  • Appear in the Windows Task Manager as if directly executed from the CMD prompt.

Windows executables run in WSL are handled similarly to native Linux executables — piping, redirects, and even backgrounding work as expected.

To run the Windows tool ipconfig.exe, use the Linux tool grep to filter the «IPv4» results, and use the Linux tool cut to remove the column fields, from a Linux distribution (for example, Ubuntu) enter:

ipconfig.exe | grep IPv4 | cut -d: -f2

Let’s try an example mixing Windows and Linux commands. Open your Linux distribution (ie. Ubuntu) and create a text file: touch foo.txt. Now use the Linux command ls -la to list the direct files and their creation details, plus the Windows PowerShell tool findstr.exe to filter the results so only your foo.txt file shows in the results:

ls -la | findstr.exe foo.txt

Windows tools must include the file extension, match the file case, and be executable. Non-executables including batch scripts. CMD native commands like dir can be run with cmd.exe /C command.

For example, list the contents of your Windows files system C: directory, by entering:

Or use the ping command to send an echo request to the microsoft.com website:

ping.exe www.microsoft.com

Parameters are passed to the Windows binary unmodified. As an example, the following command will open C:tempfoo.txt in notepad.exe:

notepad.exe "C:tempfoo.txt"

This will also work:

notepad.exe C:\temp\foo.txt

Share environment variables between Windows and WSL with WSLENV

WSL and Windows share a special environment variable, WSLENV, created to bridge Windows and Linux distributions running on WSL.

Properties of WSLENV variable:

  • It is shared; it exists in both Windows and WSL environments.
  • It is a list of environment variables to share between Windows and WSL.
  • It can format environment variables to work well in Windows and WSL.
  • It can assist in the flow between WSL and Win32.

[!NOTE]
Prior to 17063, only Windows environment variable that WSL could access was PATH (so you could launch Win32 executables from under WSL). Starting in 17063, WSLENV begins being supported.
WSLENV is case sensitive.

WSLENV flags

There are four flags available in WSLENV to influence how the environment variable is translated.

WSLENV flags:

  • /p — translates the path between WSL/Linux style paths and Win32 paths.
  • /l — indicates the environment variable is a list of paths.
  • /u — indicates that this environment variable should only be included when running WSL from Win32.
  • /w — indicates that this environment variable should only be included when running Win32 from WSL.

Flags can be combined as needed.

Read more about WSLENV, including FAQs and examples of setting the value of WSLENV to a concatenation of other pre-defined environment vars, each suffixed with a slash followed by flags to specify how the value should be translated and passing variables with a script. This article also includes an example for setting up a dev environment with the Go programming language, configured to share a GOPATH between WSL and Win32.

Disable interoperability

Users may disable the ability to run Windows tools for a single WSL session by running the following command as root:

echo 0 > /proc/sys/fs/binfmt_misc/WSLInterop

To re-enable Windows binaries, exit all WSL sessions and re-run bash.exe or run the following command as root:

echo 1 > /proc/sys/fs/binfmt_misc/WSLInterop

Disabling interop will not persist between WSL sessions — interop will be enabled again when a new session is launched.

If I read your post literally, there may be a few different questions there:

  • Where is your WSL Ubuntu instance installed on your machine?
  • (Presumably based on the first question) How do I access files in WSL2 from Windows?
  • «How do I access files in my Windows machine from WSL2?» (sort of the opposite question of the first two)

Where is your WSL Ubuntu instance?

Short answer: In your case, given the basic installation, the actual files are in a virtual disk named ext4.vhdx. You really don’t need to worry about the «where» at this point (since it’s a virtual drive), but you’ll typically find it under %userprofile%AppDataLocalPackagesCanonical...LocalStateext4.vhdx. Your %userprofile% is typically something like C:Users<username>.

More Detail:

That’s for a default installation. You can have multiple distributions installed, and even multiple instances of the same distribution. One of the great things about WSL is the ability to quickly copy a distribution, test something out, and throw away the test. This keeps you from polluting your «good», daily distribution with packages, tests, or other things that may create «cruft» over the long-term.

To see all the distributions you have installed, go to PowerShell and run:

Get-ChildItem "HKCU:SoftwareMicrosoftWindowsCurrentVersionLxss" -Recurse

In your case, you’ll probably see something like:

{cff9bfd6-39db-42af-a85b-d6fca State              : 1
94beff8}                       DistributionName   : Ubuntu
                               Version            : 2
                               BasePath           : C:UserskrutikAppDataLocalPackagesCanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgscLocalState
                               Flags              : 15
                               DefaultUid         : 1000
                               PackageFamilyName  : CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc
                               KernelCommandLine  : BOOT_IMAGE=/kernel init=/init
                               DefaultEnvironment : {HOSTTYPE=x86_64, LANG=en_US.UTF-8, PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games, TERM=xterm-256color}

I have quite a few more, in various locations.

How do I access files in WSL2 from Windows?

But the title of your question, «where», doesn’t really matter much unless you need to do something with the ext4.vhdx file (like perhaps reclaim space).

To access files in WSL from Windows, use the \wsl$Ubuntu path (or whatever your distribution is named). Here, you’ll find \wsl$Ubuntuhomenkp68, where you can safely copy in and out files.

Updated note: Under Windows 11, \wsl$<distro_name> still works, but there is also a new \wsl.localhost<disro_name> path as well. Both work the same, but wsl.localhost should be a bit more robust in certain situations.

How do I access files in my Windows machine from WSL2?

If you are in Ubuntu and need access to a file on a Windows drive (e.g. C:), then you’ll find those are (by default) auto-mounted for you:

ls /mnt/c/Users
ls /mnt/c

There are some nuances in working with files on a Windows drive from within WSL, especially around permissions and performance. You’ll typically want to keep any project files inside the Ubuntu ext4 filesystem (e.g. under your /home/nkp68 directory). But you can certainly access, copy, and move files around between the drives as needed.

Where is the WSL feature located?

The title of the question could be interpreted to mean that you want to know where the actual WSL feature is installed. I know that wasn’t the case for you, the original poster, but the question has come up from others, so I’ll add it here in case they find this based on the title.

The WSL feature itself has been installed with Windows itself since at least Windows 10 21H2 (and perhaps before). That doesn’t, however, mean that it is enabled.

When you enable it, the applicable binaries are found under C:WindowsSystem32lxss. You’ll rarely need to worry about this folder, but there are some times when it comes in handy.

The WSL2 kernel is also located in this folder, and you can back up older kernels if you want to rollback more than one release.

Windows Subsystem for Linux

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.

Windows Subsystem for Linux: Browing files with 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.

Windows Subsystem for Linux: Mapping WSL disk as network drive

Settings on screenshot above were enough for me to get my Ubuntu “disk” mapped as U: drive.

Windows Subsystem for Linux disk mapped as network drive

This drive mappings works well on my machine even when my Ubuntu is closed and not in use.

Wrapping up

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.

Gunnar Peipman

Gunnar Peipman is ASP.NET, Azure and SharePoint fan, Estonian Microsoft user group leader, blogger, conference speaker, teacher, and tech maniac. Since 2008 he is Microsoft MVP specialized on ASP.NET.

Download PC Repair Tool to quickly find & fix Windows errors automatically

Microsoft added the support for Windows Subsystem for Linux (WSL) on Windows 11 and Windows 10. It made it possible for users to install various Linux distros like Ubuntu, SUSE Linux, Kali Linux and more on Windows 10 devices. Not only is WSL getting a real Kernel, but the ability to access Linux files on Windows 11/10 using File Explorer will also be present.

Access Windows Subsystem for Linux files on Windows 10

There are two methods to access Windows Subsystem for Linux files using File Explorer on Windows 11/10:

  1. Opening File Explorer from the WSL Terminal.
  2. Launching the root from File Explorer.

1] Using File Explorer inside WSL Terminal

Access Windows Subsystem for Linux files on Windows 10

  1. Open WSL terminal.
  2. Navigate the root directory or top folder inside of the Terminal.
  3. Type in explorer.exe and hit Enter to open that location inside of the File Explorer.

2] Launching the root from File Explorer

This is a relatively straightforward method.

  1. Launch the File Explorer.
  2. Type in Linux and hit Enter in the address bar of the File Explorer.
  3. It will mount the storage for the Linux distros installed on your computer.
  4. The files are visible in File Explorer.

After you access these files within File Explorer, you can use programs installed on your computer to execute them normally. And any modification that you make will be visible inside the Terminal window.

Can you access Windows files from Linux subsystem?

Yes, you can access Windows files from the Linux subsystem and vice versa. It is possible to share and access Windows files from the Linux subsystem using the WSL terminal. You need to open the File Explorer in the terminal. In other words, you can enter the explorer.exe command in the terminal window to get access to it.

Read: An error occurred mounting one of your file systems WSL error

Where are the Linux subsystem files on Windows 11/10?

To access the Linux subsystem files or Linux Bash files on Windows 11/10, you need to go to %userprofile%AppDataLocalPackages. Alternatively, you can go to C:Usersuser-nameAppDataLocalPackages in the File Explorer. However, you must show hidden files to access the AppData folder in the C drive or system drive.

WSL has proven to be a boon for all the developers who had to dual boot a Linux flavor to get their needs with the Terminal done.

Troubleshoot: Windows Subsystem for Linux Error Messages and Codes.

Ezoic

Ayush has been a Windows enthusiast since the day he got his first PC with Windows 98SE. He is an active Windows Insider since Day 1 and has been a Windows Insider MVP.

Понравилась статья? Поделить с друзьями:
  • How to get windows 10 product key
  • How to get wifi password windows 10
  • How to get to safe mode in windows 10
  • How to get screenshot on windows
  • How to get minecraft windows 10 edition for free