Terminal 默认显示无颜色,为了方便区分不同的文件类型。
指导
macOS Mojave 终端默认使用 Bash (默认提示符 $ ) ,因此编辑其配置文件 ~/.bash_profile
添加如下两行。
export CLICOLOR=1
export LSCOLORS=gxfxaxdxcxegedabagacad
若使用 Csh (默认提示符 % ),需要修改 ~/.cshrc
。
从 macOS Catalina 开始终端将默认使用 Zsh ,其配置文件为 ~/.zshrc
。
说明
LSCOLORS 的含义:
LSCOLORS The value of this variable describes what color to use
for which attribute when colors are enabled with
CLICOLOR. This string is a concatenation of pairs of the
format fb, where f is the foreground color and b is the
background color.
The color designators are as follows:
a black
b red
c green
d brown
e blue
f magenta
g cyan
h light grey
A bold black, usually shows up as dark grey
B bold red
C bold green
D bold brown, usually shows up as yellow
E bold blue
F bold magenta
G bold cyan
H bold light grey; looks like bright white
x default foreground or background
Note that the above are standard ANSI colors. The actual
display may differ depending on the color capabilities of
the terminal in use.
The order of the attributes are as follows:
1. directory
2. symbolic link
3. socket
4. pipe
5. executable
6. block special
7. character special
8. executable with setuid bit set
9. executable with setgid bit set
10. directory writable to others, with sticky bit
11. directory writable to others, without sticky
bit
The default is “exfxcxdxbxegedabagacad”, i.e. blue fore-
ground and default background for regular directories,
black foreground and red background for setuid executa-
bles, etc.
附录
参考链接
本文由 柒 创作,采用 知识共享署名4.0
国际许可协议进行许可。
转载本站文章前请注明出处,文章作者保留所有权限。
最后编辑时间: 2019-09-09 11:23 AM