2016年1月31日 星期日

LS_COLOR 的參數意義

其實我們可以改變 BASH 中的 LS_COLORS 環境變數,這樣無論使用什麼軟體也會有相同顯示效果。</p>
 首先,登入後修改 ~/.bashrc 檔,加入或修改 ls, LS_COLOR 變數,如下:


LS_COLORS='di=1:fi=0:ln=31:pi=5:so=5:bd=5:cd=5:or=31:mi=0:ex=35:*.rpm=90'<br />
export LS_COLORS
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

http://linux-sxs.org/housekeeping/lscolors.html
http://linux.about.com/od/bgb_guide/a/gdebgb29t00.htm

沒有留言:

張貼留言