为什么ls -l
WSL 中的命令返回的文件和目录没有出现在 Windows 文件资源管理器中或使用dir
cmd 命令?
WSL2 Debian 11中ll
( ) 命令的输出:ls -l
user@computer:/mnt/c$ ll
ls: Config.Msi: Permission denied
ls: cannot access 'DumpStack.log.tmp': Permission denied
ls: cannot access 'hiberfil.sys': Permission denied
ls: cannot access 'pagefile.sys': Permission denied
ls: PerfLogs: Permission denied
ls: Recovery: Permission denied
ls: cannot access 'swapfile.sys': Permission denied
ls: 'System Volume Information': Permission denied
total 388
drwxrwxrwx 1 user user 4096 Dec 25 2020 '$Recycle.Bin'
dr-xr-xr-x 1 user user 4096 Jun 16 22:13 '$WinREAgent'
-r-xr-xr-x 1 user user 395268 Jul 10 2015 bootmgr
-r-xr-xr-x 1 user user 1 Oct 30 2015 BOOTNXT
-rwxrwxrwx 1 user user 80 Oct 21 2018 bootTel.dat
d--x--x--x 1 user user 4096 Jun 30 11:51 Config.Msi
lrwxrwxrwx 1 user user 12 Jul 10 2015 'Documents and Settings' -> /mnt/c/Users
-????????? ? ? ? ? ? DumpStack.log.tmp
-????????? ? ? ? ? ? hiberfil.sys
-????????? ? ? ? ? ? pagefile.sys
d--x--x--x 1 user user 4096 Dec 7 2019 PerfLogs
drwxrwxrwx 1 user user 4096 Feb 14 13:37 ProgramData
dr-xr-xr-x 1 user user 4096 Jun 30 14:07 'Program Files'
dr-xr-xr-x 1 user user 4096 Jun 30 14:56 'Program Files (x86)'
d--x--x--x 1 user user 4096 Mar 13 10:58 Recovery
-r-xr-xr-x 1 user user 27 Nov 30 2016 Settings.ini
drwxrwxrwx 1 user user 4096 Sep 2 2021 Strawberry
-????????? ? ? ? ? ? swapfile.sys
d--x--x--x 1 user user 4096 Jun 30 11:51 'System Volume Information'
drwxrwxrwx 1 user user 4096 Sep 21 2019 temp
dr-xr-xr-x 1 user user 4096 Dec 25 2020 Users
drwxrwxrwx 1 user user 4096 Apr 3 13:38 WCH.CN
dr-xr-xr-x 1 user user 4096 Jun 16 22:36 Windows
dir /a:h
Windows 10 命令提示符中的命令输出:
C:\>dir /a:d
C volume doesn't have a name
Volume serial number is 5DFB-D456
Directories from C:\
25/12/2020 02:49 <DIR> $Recycle.Bin
16/06/2022 22:13 <DIR> $WinREAgent
30/06/2022 11:51 <DIR> Config.Msi
10/07/2015 14:21 <JUNCTION> Documents and Settings [C:\Users]
07/12/2019 11:14 <DIR> PerfLogs
30/06/2022 14:07 <DIR> Program Files
30/06/2022 14:56 <DIR> Program Files (x86)
14/02/2022 14:37 <DIR> ProgramData
13/03/2022 11:58 <DIR> Recovery
02/09/2021 22:29 <DIR> Strawberry
30/06/2022 11:51 <DIR> System Volume Information
21/09/2019 13:37 <DIR> temp
25/12/2020 21:12 <DIR> Users
03/04/2022 13:38 <DIR> WCH.CN
16/06/2022 22:36 <DIR> Windows
0 file(s) 0 bytes
15 dir(s) 51 495 235 584 free bytes
当勾选“显示隐藏文件”选项时,Windows 文件资源管理器的屏幕截图显示了 C 卷上的文件:
如您所见,WSL 显示了更多的文件,例如bootmgr
,bootTel.dat
或命令显示比文件资源管理器更多的目录,pagefile.sys
如,或。dir /a:h
Config.Msi
Recovery
$Recycle.Bin
怎么来的?
其中许多项目还具有
S
(系统)属性,除其他外,这意味着“隐藏,但更多”。您可以使用dir/a
或dir/a:s
或禁用“隐藏受保护的操作系统文件”选项来查看它们。