1. LS_COLORS
用 dircolors -p 可以 看到缺省的颜色设置,包括各种颜色和“粗体”,下划线,闪烁等定义。
环境变量LS_COLORS时用来设置GNU ls的--color选项中的颜色的。
# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
NORMAL 00 # global default, although everything should be something.
FILE 00 # normal file
DIR 0134 # directory
Linux下面文件夹的颜色(默认为深蓝),修改文件夹颜色的方法分为三步来解决:
1、配置文件:
dircolors -p >~/.dircolors (这个名字一会会用到)
2、修改文件:
#打开文件,找到这一行:DIR 0134 # directory# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
NORMAL 00 # global default, although everything should be something.
FILE 00 # normal file
DIR 0134 # directory
LINK 0136 # symbolic link
FIFO 4033 # pipe
SOCK 0135 # socket
BLK 403301 # block device driver
#修改34,换一个想要的颜色就可以了,
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
3、重新加载:
#看一下~/.bashrc这个文件,里面有关于上面会用到的名字关联# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ] then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
#执行以下就重新加载
source ~/.bashrc
效果图:
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)