0

I recently decided that the terminal color scheme that Ubuntu uses is not optimal. I have edited .dircolors and it worked...for the most part. The issue I am having is I added two custom file extensions to .dircolors which are .R and .cpp. I wanted to make these different colors, but it only applies if I create a new file, say test.R or test.cpp, not for my already existing .R and .cpp files.

Any ideas why existing ones are not taking on the new color settings in .dircolors?

4

1 回答 1

2

这可能是因为~/.dircolors不是ls直接读取,而是在shell启动时用于设置使用的环境LS_COLORS变量ls。我敢打赌,您在列出目录时使用了两个不同的终端,一个是在修改~/.dircolors. 使更改在现有终端使用中生效eval $(dircolors ~/.dircolors)

还根据文件的模式分配颜色。例如,您的旧文件可能是可执行文件,因此优先于您定义的文件获得该颜色。在我的系统上,这些基于模式的颜色用于 setuid 和 setgid 文件、具有功能的文件和可执行文件。

于 2013-01-22T23:15:43.207 回答