WSL2 中的 Windows 目录列表很混乱

WSL2 中的 Windows 目录列表很混乱

我刚刚安装了 Win10 2004 更新和 WSL2。当我打开终端窗口并运行 时ls -l,我看到的是以下内容:

在此处输入图片描述

列表中的 Windows 目录以绿色背景突出显示,并且当路径溢出一行时,绿色会延伸到第二行末尾。有办法解决这个问题吗?

我已经使用常规 cmd.exe 和新的 Windows 终端应用程序进行了测试,并且两者都出现了问题。

答案1

这些ls颜色设置存储在 ~/.bashrc 文件的 $LS_COLORS 变量中。首先打开文件并转到末尾。搜索 LS_COLORS,您将找到一个广泛的键值对列表。您必须将它们编辑为您想要的颜色。键值含义和可用颜色代码列表来自https://linuxhint.com/ls_colors_bash/

31  = red 40  = black background  0   = default colour
32  = green   41  = red background    1   = bold
33  = orange  42  = green background  4   = underlined
34  = blue    43  = orange background 5   = flashing text
35  = purple  44  = blue background   7   = reverse field > (exchange foreground and background color)
36  = cyan    45  = purple background 8   = concealed (invisible)
37  = grey    46  = cyan background   0   = default colour
90  = dark grey   47  = grey background   1   = bold
91  = light red   100 = dark grey background  
92  = light green 101 = light red background  
93  = yellow  102 = light green background    
94  = light blue  103 = yellow background 
95  = light purple    104 = light blue background 
96  = turquoise   105 = light purple background   
97  = white   106 = turquoise background  
107 = white background    
no    Global default
fi    Normal file
di    Directory
ln    Symbolic link.
bd    Block device
cd    Character device
or    Symbolic link to a non-existent file
ex    Executable file
*.extension   Example, *.mp3

相关内容