如何自訂 xterm color

在 tcsh/csh shell 的語法 (vi .tcshrc/.cshrc)
alias ls 'ls --color'

setenv LS_COLORS

'di=94:fi=0:ln=36:pi=5:so=5:bd=5:cd=5:or=5;41:mi=0:ex=32:*.rpm=31:*.gz=31:*.png=35:*.jpg=35:*.JPG=35:*.rar=31:*.xcf=35'
(以上請併為一行)


在 bsh shell 的語法 (vi .bashrc)
alias ls='ls --color'

LS_COLORS='di=94:fi=0:ln=36:pi=5:so=5:bd=5:cd=5:or=5;41:mi=0:ex=32:*.rpm=31:*.gz=31:*.png=35:*.jpg=35:*.JPG=35:*.rar=31:*.xcf=35'
(以上請併為一行)

export LS_COLORS


縮寫代碼如下:
di = directory
fi = file
ln = symbolic link
pi = fifo file
so = socket file
bd = block (buffered) special file
cd = character (unbuffered) special file
or = symbolic link pointing to a non-existent file (orphan)
mi = non-existent file pointed to by a symbolic link (visible when you type ls
-l)
ex = file which is executable (ie. has 'x' set in permissions).

顏色代碼如下:
0 = default colour
1 = bold
4 = underlined
5 = flashing text
7 = reverse field
31 = red
32 = green
33 = orange
34 = blue
35 = purple
36 = cyan
37 = grey
40 = black background
41 = red background
42 = green background
43 = orange background
44 = blue background
45 = purple background
46 = cyan background
47 = grey background
90 = dark grey
91 = light red
92 = light green
93 = yellow
94 = light blue
95 = light purple
96 = turquoise
100 = dark grey background
101 = light red background
102 = light green background
103 = yellow background
104 = light blue background
105 = light purple background
106 = turquoise background

可以多重選擇:
di=1;31;42
目錄=粗體+紅色字體+綠色底色


也可以自訂某些副檔名的顏色
*.jpg=4;5;33
*.jpg=底線+閃爍+橘色字體


以上只是示範,千萬不要這樣設定,保證很醜!



參考資料:
COLORS-Lscolors
用 ls 顯示特殊中文檔名和目錄
GNU & Unix Commands
bash / csh 奮戰筆記

Comments

Popular posts from this blog

梵文學習筆記 (2) 從大悲咒談起

大馬歌手黃明志

我要當中國人,不要當台灣人