ls man page当然会解释dir_colors --colors
标记,并在页面底部提到了使用written by others who have used dir_colors进一步自定义的想法。我进一步找到了一些有用的页面{{3}},但还不足以让我一直找到我正在寻找的答案。
我想问的是:
我需要附加到.bashrc文件以使具有给定扩展名的文件以给定颜色显示?
举一个例子,我怎么能让所有.sh文件显示为橙色?或者所有.tar.gz文件都显示为红色?
答案 0 :(得分:-1)
没有橙色: - )
以下是我的〜/ .dir_colors(多年前继承)的点点滴滴
它由.bashrc中的eval dircolors ~/.dir_colors
加载:
# 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 01;34 # directory
LINK 01;36 # symbolic link
FIFO 40;33 # pipe
SOCK 00;35 # socket
BLK 40;33;01 # block device driver
CHR 40;33;01 # character device driver
ORPHAN 01;05;37;41 # orphaned syminks
MISSING 01;05;37;41 # ... and the files they point to
# This is for files with execute permission:
EXEC 01;32
然后一些用于.sh和.gz:
.sh 01;32 # executable in bold green
.csh 01;32
.tar 01;31 # archives or compressed (bright red)
.tgz 01;31
.arj 00;31
.taz 01;31
.lzh 00;31
.rar 01;31
.RAR 01;31
.zip 01;31
.ZIP 01;31
.z 01;31
.Z 01;31
.gz 01;31
.bz2 01;31
.bz 01;31
.tz 01;31
.jar 01;31
.rpm 01;31
.deb 01;31
.cpio 01;31
.iso 01;31
.ISO 01;31
橙色,也许黄色足够好?
.sh 01;33 # shell in bold yellow