之前重度使用的操作系统一直是MacOS,没太了解ubuntu系统,一直以为MacOS和ubuntu的设置是一样的,结果没想到在设置ls命令的颜色上兜兜转转了这么久。
在ubuntu系统中,bash样式的更改是更改 ~/.bashrc文件,而在MacOS中是修改~/.bash_profile文件。两者修改LS的命令也不一样
在ubuntu中:
LS_COLORS=$LS_COLORS:'di=0;35:'
export LS_COLORS
其中0;35中的0表示样式,其余样式组合如下:
0 = default colour
1 = bold
4 = underlined
5 = flashing text (disabled on some terminals)
7 = reverse field (exchange foreground and background color)
8 = concealed (invisible)
其中0;35中的35表示字的颜色,其余样式组合如下:
Blue = 34
Green = 32
Light Green = 1;32
Cyan = 36
Red = 31
Purple = 35
Brown = 33
Yellow = 1;33
Bold White = 1;37
Light Grey = 0;37
Black = 30
Dark Grey= 1;30
在MacOS中:
export LS_OPTIONS='--color=auto'
export CLICOLOR='Yes'
export LSCOLORS='CxfxcxdxbxegedabagGxGx'
CxfxcxdxbxegedabagGxGx 表示的是青色。