我在Windows 10上安装了Ubuntu子系统(在设置中启用了该功能),但是Ubuntu文件系统的根目录在哪个驱动器中?
对于从Windows商店安装的Ubuntu:
通过商店安装的每个发行版都会被安装到该应用程序的appdata目录中。例如:
C:\Users\<username>\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState
- benhillis
对于WSL2,您可以像这样从Windows访问主目录(适用于Windows 10版本18342):
\\wsl$
%localappdata%\Lxss
(例如,C:\Users\Username\AppData\Local\Lxss
- 将Username替换为您在Windows上的用户名)。请参阅WSL文件系统支持的博文。使用Windows应用程序和工具在Linux子系统中创建/修改任何文件可能会导致数据损坏和数据丢失!(感谢Rich Turner 提醒大家注意这些问题!)这是绝对不支持的。从同一篇博客文章中:
与Windows的互操作性
虽然VolFs文件存储在上述目录中的普通文件中,但不支持与Windows的互操作性。如果从Windows添加新文件到其中一个目录中,该文件缺少VolFs所需的扩展属性(EAs),因此VolFs不知道如何处理该文件,只会忽略它。许多编辑器在保存现有文件时也会删除扩展属性,再次使该文件在WSL中无法使用。
/mnt/c
。
来源:Dustin Kirkland的博客},{link2:howtogeek
type git
查看 git 可执行文件的位置。 - sourav c.attrib -s -h lxss
命令来取消隐藏,这也会将其标记为非系统目录。 - brettwhitemanC:
驱动器可以在 /mnt/c
访问。 - sourav c./mnt/<drive>/<path>
路径进行访问。 - Rich Turnerdev
到 /mnt/c/dev
的符号链接,以便更方便地访问我的开发项目。 - Rich Turner%localappdata%\lxss\home\{username}
或者:
C:\Users\{user}\AppData\Local\lxss\{username}
其中{user}
是您的Windows用户名,{username}
是您在安装过程中设置的UNIX用户名。
因此,根目录将是:
%localappdata%\lxss
%localappdata%
目录中显示出来。不过,您仍然可以通过在资源管理器的“地址栏”中输入它来访问它。%localappdata%\lxss
下面。没有一个子目录使用我的“UNIX”用户名;home 是一个子目录,而在 home 下面有一个子目录用于我的 UNIX 用户名。 - Kenny Evitt$ cat /proc/registry/HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Lxss/\{861c29b4-ebe2-49a5-8a22-7e53a27934a0\}/BasePath
C:\Users\user\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState
bash# cat /proc/registry/HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Lxss/DefaultDistribution
{861c29b4-ebe2-49a5-8a22-7e53a27934a0}
c:/Users/user/AppData/Local/Packages/46932SUSE.openSUSELeap42.2_022rs5jcyhyac/LocalState/rootfs
# obtain the value of the ID of the default Linux distribution (and store it in a variable to avoid escaping characters issues):
$DEFAULT_LXSS_ID = (Get-ItemPropertyValue -Path REGISTRY::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\ -name DefaultDistribution)
# which will have a value like:
echo $DEFAULT_LXSS_ID
{bde539d6-0c87-4e12-9599-1dcd623fbf07}
# display the directory containing the rootfs Windows directory (mapped to the / Linux directory)
Get-ItemPropertyValue -Path REGISTRY::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\$DEFAULT_LXSS_ID -name BasePath | Format-List -property "BasePath"
%LocalAppData%\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState
https://www.howtogeek.com/270810/how-to-quickly-launch-a-bash-shell-from-windows-10s-file-explorer/
ls -a
时,它没有显示我添加的文件。Bash无法识别我通过Windows文件资源管理器放置的文件,这对我来说完全背离了在Windows上安装Bash的目的。 - user453720%localappdata%\lxss\home\{username}
,其中的{username}
是在安装过程中为BASH用户名设置的。出于某种原因,在显示隐藏文件夹后,lxss文件夹不会出现在C:\Users\WINDOWS-USER\AppData\Local\
下,同时使用包含Windows和BASH用户名的完整C:\
路径也无法生效。C:\Users\\[username]\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\ext4.vhdx
wsl.exe
,例如wsl chmod 600 ~/.ssh/id*
- 不要通过Windows文件系统将文件复制到这些文件夹中。 - Rich Turner