Quel est le répertoire personnel sur Windows Subsystem for Linux ?

Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

Quel est le répertoire personnel sur Windows Subsystem for Linux ?

Message par Clippy »

Quand je start `bash` on Windows Subsystem for Linux, it drops me in the directory

```
/mnt/c/Users/

```

Quand je `ls` this directory, Je vois the directories `Desktop`, `Documents`, etc. that I can see are in `C:\Users\` using the Windows Explorateur de fichiers. Since this is where the `bash` program started, Je m'attendais à this is my home directory, but when I type either `cd` or `cd ~` I am brought to

```
/home/

```

which contains my `.bashrc`, `.profile` etc. file which I would expect to find in my home directory in a Linux box. De plus, entering `cd ../..` à partir de là I can see the directories `bin`, `etc` and so on, again as expected on a Linux box.

J'ai two questions regarding all this:

- What exactly is `/mnt/c/Users/` compared with `C:\Users\`? It seems they are one in the same---so what is `/mnt/c/`?

- Comment puis-je view the files in `/home/` using the Windows Explorateur de fichiers? Non pas que j'en aie vraiment envie---j'essaie juste de comprendre how Windows is organizing this Subsystem for Linux thing.
Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

Re: Quel est le répertoire personnel sur Windows Subsystem for Linux ?

Message par Clippy »

In the latest versions [2025 WSL2], the système de fichiers is accessed from:
`# \\wsl.localhost\
shortcut:
# \\wsl$\:
ex:
\\wsl$\Ubuntu

```

You can also find this path by starting the distro then running `$ wslpath -w $HOME`

The files themselves seem to be stored within a .vhdx file in a similar location to 2020's solution.

```
%LOCALAPPDATA%\wsl\\ext4.vhdx

```

For older WSL2 installs [2020] it would be a file like:

```
%LOCALAPPDATA%\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\ext4.vhdx

```

For example with Debian the file would be a file that is an ext4 virtual disk:

```
%LOCALAPPDATA%\Packages\YourDistroName-ID\LocalState, vous pouvez voir a nom de fichierd ext4.vhdx

```

You can find the exact filenames by referencing the [registry](https://stackoverflow.com/a/51576305/32453), ex: powershell:

```
(Get-ChildItem HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss | ForEach-Object {Get-ItemProperty $_.PSPath}) | select DistributionName,BasePath,VhdFileName

```

Also useful if a distro isn't installed in the standard directory, doesn't seem possible to get using `wsl` command from the command prompt.

Previously, in 2018, The root Linux path was related to which distribution you had installed from the Microsoft Store rather than one global path; for Ubuntu, it was located at:

```
%LOCALAPPDATA%\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs

```

but with the files stored directly on the NTFS système de fichiers.
Répondre

Revenir à « Windows 10 »