WSL Linux 不知道其他分区上存在目录 - 帮助

WSL Linux 不知道其他分区上存在目录 - 帮助

标题解释了这一点,我在 WSL 上安装了新的 Linux,但它在我的笔记本电脑上看不到现有目录。我不确定问题是什么,我已经尝试了网上的内容来评估问题,但无济于事。我只能猜测是安装错误或者我是 Linux 菜鸟。感谢任何帮助,以下是商品

编辑 1:问题是我无法访问 Windows 驱动器的目录,例如下面代码中看到的 C:\Users\someuser\Documents。使用 ls 查找 Linux 系统的哪些目录没有出现任何内容,即使我位于我的主目录中

roman@DESKTOP-QKJTF3S:~$ which ls
/usr/bin/ls
roman@DESKTOP-QKJTF3S:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.UbuntuonWindows_2004.2021.825.0_x64__79rhkp1fndgsc:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/Program Files/MATLAB/R2021a/runtime/win64:/mnt/c/Program Files/MATLAB/R2021a/bin:/mnt/c/Program Files (x86)/Windows Kits/8.1/Windows Performance Toolkit/:/mnt/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/110/Tools/Binn/:/mnt/c/Program Files (x86)/Microsoft SQL Server/120/Tools/Binn/:/mnt/c/Program Files/Microsoft SQL Server/120/Tools/Binn/:/mnt/c/Program Files/Microsoft SQL Server/120/DTS/Binn/:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Git/cmd:/mnt/c/Users/roman/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/roman/AppData/Local/GitHubDesktop/bin:/mnt/c/Users/roman/AppData/Local/atom/bin:/snap/bin
roman@DESKTOP-QKJTF3S:~$ ls
roman@DESKTOP-QKJTF3S:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs          459G  375G   85G  82% /
none            459G  375G   85G  82% /dev
none            459G  375G   85G  82% /run
none            459G  375G   85G  82% /run/lock
none            459G  375G   85G  82% /run/shm
none            459G  375G   85G  82% /run/user
tmpfs           459G  375G   85G  82% /sys/fs/cgroup
C:\             459G  375G   85G  82% /mnt/c
roman@DESKTOP-QKJTF3S:~$ ls -la
total 8
drwxr-xr-x 1 roman roman  512 Feb 16 16:08 .
drwxr-xr-x 1 root  root   512 Feb  9 15:08 ..
-rw------- 1 roman roman  285 Feb 16 16:08 .bash_history
-rw-r--r-- 1 roman roman  220 Feb  9 15:08 .bash_logout
-rw-r--r-- 1 roman roman 3771 Feb  9 15:08 .bashrc
drwxr-xr-x 1 roman roman  512 Feb  9 15:08 .landscape
-rw-r--r-- 1 roman roman    0 Feb 16 15:46 .motd_shown
-rw-r--r-- 1 roman roman  807 Feb  9 15:08 .profile
-rw-r--r-- 1 roman roman    0 Feb  9 15:11 .sudo_as_admin_successful
roman@DESKTOP-QKJTF3S:~$ type ls
ls is aliased to `ls --color=auto'
roman@DESKTOP-QKJTF3S:~$ dir
roman@DESKTOP-QKJTF3S:~$ ls
roman@DESKTOP-QKJTF3S:~$ mkdir tmp
roman@DESKTOP-QKJTF3S:~$ cd
roman@DESKTOP-QKJTF3S:~$ cd tmp
roman@DESKTOP-QKJTF3S:~/tmp$ ls
roman@DESKTOP-QKJTF3S:~/tmp$ cd
roman@DESKTOP-QKJTF3S:~$ ls
tmp
roman@DESKTOP-QKJTF3S:~$ cd
roman@DESKTOP-QKJTF3S:~$ find
.
./.bashrc
./.bash_history
./.bash_logout
./.landscape
./.landscape/sysinfo.log
./.motd_shown
./.profile
./.sudo_as_admin_successful
./tmp
roman@DESKTOP-QKJTF3S:~$ ls
tmp
roman@DESKTOP-QKJTF3S:~$
roman@DESKTOP-QKJTF3S:~$ pwd
/home/roman
roman@DESKTOP-QKJTF3S:~$ cd ~/Documents
-bash: cd: /home/roman/Documents: No such file or directory
roman@DESKTOP-QKJTF3S:~$ cd ./Documents
-bash: cd: ./Documents: No such file or directory
roman@DESKTOP-QKJTF3S:~$ cd ~/.Documents
-bash: cd: /home/roman/.Documents: No such file or directory
roman@DESKTOP-QKJTF3S:~$ cd ./Documents
-bash: cd: ./Documents: No such file or directory
roman@DESKTOP-QKJTF3S:~$ ~/Documents
-bash: /home/roman/Documents: No such file or directory
roman@DESKTOP-QKJTF3S:~$ ~/Documents$
-bash: /home/roman/Documents$: No such file or directory
roman@DESKTOP-QKJTF3S:~$ ~/Documents$ find
-bash: /home/roman/Documents$: No such file or directory
roman@DESKTOP-QKJTF3S:~$ cd Documents
-bash: cd: Documents: No such file or directory
roman@DESKTOP-QKJTF3S:~$ tmp

Command 'tmp' not found, but there are 16 similar ones.

roman@DESKTOP-QKJTF3S:~$ cd
roman@DESKTOP-QKJTF3S:~$ cd /tmp
roman@DESKTOP-QKJTF3S:/tmp$ cd
roman@DESKTOP-QKJTF3S:~$ ./.Documents
-bash: ./.Documents: No such file or directory
roman@DESKTOP-QKJTF3S:~$

编辑 2:“mount”的代码,根据此显示所有当前附加的文件系统地点

roman@DESKTOP-QKJTF3S:~$ mount
rootfs on / type wslfs (rw,noatime)
none on /dev type tmpfs (rw,noatime,mode=755)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
devpts on /dev/pts type devpts (rw,nosuid,noexec,noatime,gid=5,mode=620)
none on /run type tmpfs (rw,nosuid,noexec,noatime,mode=755)
none on /run/lock type tmpfs (rw,nosuid,nodev,noexec,noatime)
none on /run/shm type tmpfs (rw,nosuid,nodev,noatime)
none on /run/user type tmpfs (rw,nosuid,nodev,noexec,noatime,mode=755)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)
tmpfs on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,relatime,mode=755)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
C:\ on /mnt/c type drvfs (rw,noatime,uid=1000,gid=1000,case=off)
roman@DESKTOP-QKJTF3S:~$ mount -t ext4
roman@DESKTOP-QKJTF3S:~$

编辑 3:进展,发现已安装名为“c”的文件系统,但其中的文件不匹配。

roman@DESKTOP-QKJTF3S:~$ /mnt
-bash: /mnt: Is a directory
roman@DESKTOP-QKJTF3S:~$ /mnt/c
-bash: /mnt/c: Is a directory
roman@DESKTOP-QKJTF3S:~$ cd /mnt/c
roman@DESKTOP-QKJTF3S:/mnt/c$ cd /users
-bash: cd: /users: No such file or directory
roman@DESKTOP-QKJTF3S:/mnt/c$ cd /Users
-bash: cd: /Users: No such file or directory
roman@DESKTOP-QKJTF3S:/mnt/c$ ls
ls: cannot access 'DumpStack.log.tmp': Permission denied
ls: cannot access 'hiberfil.sys': Permission denied
ls: cannot access 'pagefile.sys': Permission denied
ls: cannot access 'swapfile.sys': Permission denied
'$Recycle.Bin'                                             ProgramData                  eula.3082.txt
'$WinREAgent'                                              Recovery                     globdata.ini
Apps                                                     'SOLIDWORKS Data'             hiberfil.sys
Config.Msi                                               'SOLIDWORKS Data (2)'         install.exe
Dell                                                     'System Volume Information'   install.ini
'Documents and Settings'                                   Users                        install.res.1028.dll
Downloads                                                 VC_RED.MSI                   install.res.1031.dll
Drivers                                                   VC_RED.cab                   install.res.1033.dll
DumpStack.log                                             Windows                      install.res.1036.dll
DumpStack.log.tmp                                         cygwin64                     install.res.1040.dll
Games                                                     dell.sdr                     install.res.1041.dll
Intel                                                     eula.1028.txt                install.res.1042.dll
NvContainerRecoveryNVDisplay.ContainerLocalSystem.reg     eula.1031.txt                install.res.2052.dll
NvContainerRecoveryNvBroadcast.ContainerLocalSystem.reg   eula.1033.txt                install.res.3082.dll
NvContainerRecoveryNvContainerLocalSystem.reg             eula.1036.txt                pagefile.sys
OneDriveTemp                                              eula.1040.txt                swapfile.sys
PerfLogs                                                  eula.1041.txt                temp
'Program Files'                                            eula.1042.txt                vcredist.bmp
'Program Files (x86)'                                      eula.2052.txt
roman@DESKTOP-QKJTF3S:/mnt/c$ cd /Documents and Settings
-bash: cd: too many arguments
roman@DESKTOP-QKJTF3S:/mnt/c$ cd /Documents
-bash: cd: /Documents: No such file or directory
roman@DESKTOP-QKJTF3S:/mnt/c$ cd /Downloads
-bash: cd: /Downloads: No such file or directory
roman@DESKTOP-QKJTF3S:/mnt/c$ cd ./Downloads
roman@DESKTOP-QKJTF3S:/mnt/c/Downloads$ cd
roman@DESKTOP-QKJTF3S:~$ cd /mnt/c/.Documents
-bash: cd: /mnt/c/.Documents: No such file or directory
roman@DESKTOP-QKJTF3S:~$ cd /mnt/c
roman@DESKTOP-QKJTF3S:/mnt/c$ cd ./Documents
-bash: cd: ./Documents: No such file or directory
roman@DESKTOP-QKJTF3S:/mnt/c$ cd ./Documents and Settings
-bash: cd: too many arguments
roman@DESKTOP-QKJTF3S:/mnt/c$ cd ./Documents_and_Settings
-bash: cd: ./Documents_and_Settings: No such file or directory
roman@DESKTOP-QKJTF3S:/mnt/c$ cd ./Downloads
roman@DESKTOP-QKJTF3S:/mnt/c/Downloads$ ls
Updater_SA_Upgrade
roman@DESKTOP-QKJTF3S:/mnt/c/Downloads$ ls -la
total 0
drwxrwxrwx 1 roman roman 512 Apr 16  2020 .
drwxrwxrwx 1 roman roman 512 Feb 11 17:47 ..
drwxrwxrwx 1 roman roman 512 Apr 16  2020 Updater_SA_Upgrade
roman@DESKTOP-QKJTF3S:/mnt/c/Downloads$

答案1

通过 Windows Store 安装 WSL Ubuntu Linux 时,Windows C: 驱动器已安装到 Linux 系统,您可以在/mnt/c/.文档文件夹可以在 中找到/mnt/c/Users/someuser/Documents。您可以通过以下方式将工作目录更改为 C: 驱动器cd(C杭格d目录)像cd /mnt/c/

这是 @mashuptwice 的礼貌,引导像我这样的菜鸟完成它,他们摇滚

相关内容