By default, color is not used to distinguish types of files. You need to pass --color
option to the ls command on Linux.
有些集群默认不显示显示区分,则需要使用命令保持开启颜色显示
alias ls='ls --color=auto'
输出颜色变量:echo $LS_COLORS
You can run the following command to export LS_COLORS variable to the end of your ~/.bashrc file:
dircolors -b >> .bashrc
随后进行个性化调整颜色配置
#List of Available Color Codes
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
#List of Some of the Available Keys
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
LS_COLORS key value pairs are separated by colon ( : )
The values have 2 or more parts separated by semicolon (;)
设置好后 source ~/.bashrc
网友评论