- Access Linux filesystems in Windows and WSL 2
- Getting started
- Accessing these files with File Explorer
- Limitations
- Give us your feedback!
- How to access Windows Subsystem for Linux files on Windows 10
- Access Windows Subsystem for Linux files on Windows
- 1] Using File Explorer inside WSL Terminal
- 2] Launching the root from File Explorer
- Related Posts
- Windows Subsystem for Linux has no installed distributions
- Failed to Fork error with Ubuntu on Windows 10
- How to run .sh or Shell Script file in Windows 10
- [email protected]
- How do I access the WSL Linux file system from Windows?
- 6 Answers 6
- Access WSL Linux Files from Windows 10
- Access Linux Files in Command Line
- Known issues
- About Sergey Tkachenko
- 2 thoughts on “ Access WSL Linux Files from Windows 10 ”
- Leave a Reply Cancel reply
- Connect with us
- Крутые лайфхаки для работы с WSL (Подсистема Windows для Linux )
- Запустите Windows Explorer из Linux и получите доступ к файлам вашего дистрибутива
- Используйте настоящие команды Linux (не CGYWIN) из Windows
- Запустите Visual Studio Code и получите доступ к вашим приложениям Linux нативно на Windows
- Запуск нескольких Linux в считанные секунды
- Запустите X Windows Server под Windows с Pengwin
- Простое перемещение дистрибутивов WSL между системами Windows.
- Используйте провайдер учетных данных Windows Git внутри WSL
Access Linux filesystems in Windows and WSL 2
September 10th, 2020
Starting with Windows Insiders preview build 20211, WSL 2 will be offering a new feature: wsl —mount . This new parameter allows a physical disk to be attached and mounted inside WSL 2, which enables you to access filesystems that aren’t natively supported by Windows (such as ext4).
So, if you’re dual booting with Windows & Linux using different disks, you can now access your Linux files from Windows!
Getting started
To mount a disk, open a PowerShell window with administrator privileges and run:
To list the available disks in Windows, run:
To unmount and detach the disk from WSL 2, run
The disks paths are available under the ‘DeviceID’ columns. Usually under the \\.\\\.\PHYSICALDRIVE* format. Below is an example of mounting a specific partition of a given hard disk into WSL and browsing its files.
Accessing these files with File Explorer
Once mounted, it’s also possible to access these disks through the Windows explorer by navigating to \wsl$ and then to the mount folder.
Limitations
By default, wsl —mount attempts to mount the disk as ext4. To specify a filesystem, or for more advanced scenarios, check out Mount a disk in WSL 2.
Also please note that this feature comes with the limitation that only physical disks can be attached to WSL 2. At this time, it’s not possible to attach a single partition. More details on the limitations here.
Give us your feedback!
If you run into any issues, or have feedback for our team please file an issue on our Github , and if you have general questions about WSL you can find all of our team members that are on Twitter on this twitter list.
How to access Windows Subsystem for Linux files on Windows 10
Microsoft added the support for Windows Subsystem for Linux (WSL) on Windows 10 back with the Windows 10 v1607. It made it possible for users to install various Linux distros like Ubuntu, SUSE Linux, Kali Linux and more on Windows 10 devices. In the feature update, v1903, not only is WSL getting a real Kernel, but the ability to access Linux files on Windows 10 using File Explorer will also be present.
Access Windows Subsystem for Linux files on Windows
There are two methods to access Windows Subsystem for Linux files using File Explorer on Windows 10:
- Opening File Explorer from the WSL Terminal.
- Launching the root from File Explorer.
1] Using File Explorer inside WSL Terminal
- Open WSL terminal.
- Navigate the root directory or top folder inside of the Terminal.
- 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 straight forward method.
- Launch the File Explorer.
- Type in Linux and hit Enter in the address bar of the File Explorer.
- It will mount the storage for the Linux distros installed on your computer.
- The files are visible in the File Explorer.
After you access these files within the 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.
WSL has proven to be a boon for all the developers who had to dual boot a Linux flavor to get them needs with the Terminal done.
Date: May 23, 2019 Tags: WSL
Related Posts
Windows Subsystem for Linux has no installed distributions
Failed to Fork error with Ubuntu on Windows 10
How to run .sh or Shell Script file in Windows 10
[email protected]
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 is now a Windows Insider MVP. He has been testing pre-release services on his Windows 10 PC, Lumia, and Android devices.
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:
and this is the Linux file system:
6 Answers 6
PM for Windows Command-Line here:
However, as of Windows 10 build 1903 (March 2019), we (finally!) exposed your distros’ filesystems to Windows!
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.
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.
Access WSL Linux Files from Windows 10
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.
After enabling WSL, you can install various Linux versions from the Store. You can use the following links:
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.
- Enable the WSL feature.
- Install some distro, e.g. Ubuntu, and start it.
- While in a directory on a Linux FS, type explorer . .
- This will open a File Explorer window, located inside of your Linux distro.
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$\ \.
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$\
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$\Ubuntu\home will not work (as CMD does not support UNC paths as current directories), however copy \\wsl$\Ubuntu\home\somefile.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.
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:
Share this post
About Sergey Tkachenko
Sergey Tkachenko is a software developer from Russia who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.
2 thoughts on “ Access WSL Linux Files from Windows 10 ”
I tried to `cd \\wsl$` and `cd \\wsl$/` and it didn’t work.
I just realised it doesn’t work with Powershell Core 6.
Leave a Reply Cancel reply
Connect with us
We discontinued Facebook to deliver our post updates.
Крутые лайфхаки для работы с WSL (Подсистема Windows для Linux )
Я глубоко погружен в WSL (Windows Subsystem для Linux), и теперь, когда WSL2 доступен в Windows Insiders, это отличное время, чтобы по-настоящему изучить доступные опции. Очень интересная фича, которую я нашел в WSL, — возможность «чисто» перемещать данные между мирами. Это не тот опыт, который вы легко можете получить с полноценными виртуальными машинами, и он говорит о тесной интеграции Linux и Windows.
Под катом подробнее о некоторых интересных вещах, которые вы можете делать, смешивая арахисовое масло и шоколад!
Запустите Windows Explorer из Linux и получите доступ к файлам вашего дистрибутива
Когда вы находитесь в командной строке WSL / bash и хотите получить визуальный доступ к своим файлам, вы можете запустить «explorer.exe .», где находится текущий каталог, и вы получите окно проводника Windows, в котором ваши файлы Linux будут доставлены вам через сервер локальной сети plan9.
Используйте настоящие команды Linux (не CGYWIN) из Windows
Я уже писал об этом раньше, но теперь есть алиасы для функций PowerShell, которые позволяют вам использовать настоящие команды Linux изнутри Windows.
Вы можете вызвать любую команду Linux напрямую из DOS/Windows/чего угодно, просто поместив ее после WSL.exe, вот так.
Исполняемые файлы Windows можно вызывать/запускать из WSL/Linux, поскольку путь к Windows находится в $PATH до Windows. Все, что вам нужно сделать, это явно вызвать его с .exe в конце. Вот как работает «Explorer.exe.». Вы также можете сделать notepad.exe или любой другой файл.
Запустите Visual Studio Code и получите доступ к вашим приложениям Linux нативно на Windows
Вы можете запустить «code.», находясь в папке в WSL, и вам будет предложено установить расширения VS Remote.. Это эффективно разделяет Visual Studio Code пополам и запускает «headless» VS Code Server в Linux с клиентом VS Code в мире Windows.
Вам также необходимо установить Visual Studio Code и расширение Remote — WSL. При желании, установите бета-версию Windows Terminal для лучшего опыта работы с терминалом в Windows.
Вот отличная подборка статей из блога Windows Command Line.
- Виртуальные машины являются ресурсоемкими и создают очень независимый опыт.
- Исходный WSL был очень «подключенным», но имел довольно низкую производительность по сравнению с VM.
- WSL 2 предлагает гибридный подход с облегченными VM, полностью подключенным интерфейсом и высокой производительностью.
Запуск нескольких Linux в считанные секунды
Здесь я использую «wsl —list —all», и в моей системе уже есть три Linux.
Я могу легко запустить их, а также назначить профили, чтобы они появлялись в моем Windows Terminal.
Запустите X Windows Server под Windows с Pengwin
Pengwin — это специальный Linux-дистрибутив WSL, который очень крут. Вы можете получить его в Windows Store. Объедините Pengwin с X Server, например X410, и вы получите очень классную интегрированную систему.
Простое перемещение дистрибутивов WSL между системами Windows.
Ana Betts отмечает эту замечательную технику, с помощью которой вы можете легко перенести свой идеальный дистрибутив WSL2 с одной машины на n машин.
Вот и все. Получите идеальную настройку Linux, синхронизированную на всех ваших системах.
Используйте провайдер учетных данных Windows Git внутри WSL
Все перечисленные фичи переткают в кульминацию в этом крутом посте от Ana Betts, где она интегрирует Windows Git Credential Provider в WSL, превращая /usr/bin/git-credential-manager в сценарий оболочки, который вызывает диспетчер git creds Windows. Гениально. Это было бы возможно только при условии чистой и тесной интеграции.