5 Answers
Reset to default
20
$Home location
To access $home type: \\wsl.localhost\Ubuntu\home\{username}
into Windows Explorer
Notes:
- This answer applies to WSL2 (this is the default version installed since Windows 10 version 2004).
Ubuntu
is the version ('distribution') of Linux installed by default, if you chose to install a different 'distro', you need to change this part{username}
is the user you specified as part of the WSL setup, not necessarily your Windows username- The linux environment runs as a VM in Hyper-V and all files in the WSL are actually contained inside a virtual hard-drive (
.vhdx
file) however Windows exposes the contents of the.vhdx
file as the virtual network path listed above. - The
.vhdx
file is stored in:%LocalAppData%\Packages\CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc\LocalState
Acknowledgements
• @DuncG's answer (used as a base and then clarified and extended)
• @Yisroel-tech's devblogs link (would recommend this to any other new WSL users)
• @user1686 for your additional info and explanation of the .vhdx
situation
Improve this answer
edited Jun 29, 2023 at 23:00
answered Jun 25, 2023 at 19:38
MartinMartin
2,19633 gold badges99 silver badges2222 bronze badges
3
-
WSL installs since Win10 v2004
that's completely wrong. WSL1 and WSL2 are independent and you can switch between them depending on what you need. WSL2 has better IO but WSL1 doesn't depend on virtualization so it's faster–phuclv
Commented Jun 26, 2023 at 15:56
-
@phuclv -- As advised previously, I am new to WSL so my knowledge is limited. AFAIU though, WSL2 is the default version that gets installed when following the Microsoft WSL install steps and WSL2 replaced WSL1 as the default, when it was introduced as part of Windows 10, version 2004 -- hence, if you run the command
WSL --install
on W10 v2004 or later, you will get WSL2 installed.–Martin
Commented Jun 26, 2023 at 21:27
-
I had to replace
wsl.localhost
withwsl$
.–victorlin
Commented May 29, 2024 at 21:32
Add a comment |
4
With WSL2 you're working in a virtual machine – the entire Linux environment is a VM running on Hyper-V, with a .vhdx
image storing its Ext4-formatted disk (including all of the files at /home).
The image is located in some subdirectory of ~\AppData\Local\Packages
, depending on which distribution you have installed (each of them is a separate "app"). See How to manage WSL disk space for more details.
Note that while you can attach a .vhdx directly in Windows, it still won't understand the Ext4 filesystem.
For WSL1, the Linux filesystem was stored as individual files in a rootfs
directory (at the same location under AppData). However, the files are not meant to be accessed directly as they have hidden attributes storing the Linux-specific metadata (e.g. Linux file permissions); directly editing the files could lose the extended attributes.
Improve this answer
answered Jun 25, 2023 at 19:04
grawitygrawity
493k6767 gold badges1k1k silver badges1.1k1.1k bronze badges
1
-
Thanks @user1686 -- Yeah so I had seen other posts talking about this but was a bit confusing (am guessing the paths changed a few times?)... stackoverflow.com/a/49196815/15919675 said
%LocalAppData%\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home
-- but that didn't work for me... stackoverflow.com/a/40874518/15919675 said:%LocalAppData%\Lxss\home
but that didn't work for me either 🙈... I did come across the.vhdx
file, but like you say couldn't open it so was a bit stuck!–Martin
Commented Jun 25, 2023 at 19:26
Add a comment |
Not sure if this helps your case. In my WSL1 instance the Linux folders are listed in a new "Linux" section of Windows Explorer. Clicking on the different installation instance names to explore or try dir with UNC path something like:
dir \\wsl.localhost\Ubuntu-20.04\home\youruserid
In explorer, just find the folder you want and "Copy Path" will provide the UNC path to same which you can paste into a Windows command prompt.
Improve this answer
answered Jun 25, 2023 at 18:56
DuncGDuncG
58211 gold badge33 silver badges1010 bronze badges
1
-
Thanks DuncG -- Your post has the answer, more or less and typing
\\wsl.localhost\Ubuntu\home\{username}
into Windows Explorer was what I needed to do... Just to point out thought that I didn't have the "Linux" section in Windows Explorer (I know it's supposed to be there generally, but can't see it)... Also, I know what you're saying about the "Copy Path" thing to get the path of a sub-folder, etc but my point was that I was struggling to find the root/home directory to start with (so couldn't even get my explorer to the right point to start with)–Martin
Commented Jun 25, 2023 at 19:18
Add a comment |
In a Windows 11 environment with WSL2 and Ubuntu 24.04 version installed you can find the Linux subsystem folder in the next path:
\\wsl.localhost\Ubuntu-24.04
If you want to enter your home folder you can find in:
\\wsl.localhost\Ubuntu-24.04\home\<<user_name>>
If you want to find the virtual volume disk you can find it here:
C:\Users\<<user_name>>\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu24.04LTS_79rhkp1fndgsc\LocalState
Improve this answer
answered Aug 5, 2024 at 9:02
almoraleslopezalmoraleslopez
10111 bronze badge
Add a comment |
Easiest way, by far, is to just type \\wsl$
This way you do not need to know the version of ubuntu installed, the username etc. Then just drill down into your home directory.
Usually though, in windows, if you open up your file explorer, just scroll down to "Network", from there you can also see your WSL folder. If it is not automatically there, just right click and map network drive, type in \\wsl$
Improve this answer
edited yesterday
answered yesterday
Eddie NewmanEddie Newman
111 bronze badge
New contributor
Eddie Newman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.Check out our Code of Conduct.
1
-
1
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
–CommunityBot
Commented yesterday
Add a comment |
You must log in to answer this question.
Start asking to get answers
Find the answer to your question by asking.
Ask question
Explore related questions
- windows-subsystem-for-linux
See similar questions with these tags.