三步驟完成修改mac的終端機terminal的顏色顯示設定

mac的終端機修改設定中的選項可改成某一個預設值是黑底白字,這樣看起來較不傷眼。

可是資料一多後,一樣都是白字會不容易辨別這是資料夾或是目錄之類的,這裡提供一個簡單三步驟,可使其依性質而顯示不同顏色。

步驟一、打開終端機,輸入vi ~/.bash_profile

步驟二、在新開的畫面中,按i進入vi編輯器的編輯模式,貼上以下文字:

#enables color in the terminal bash shell
export CLICOLOR=1
#sets up the color scheme for list
export LSCOLORS=ExFxCxDxBxegedabagacad
#enables color for iTerm
export TERM=xterm-color
#sets up proper alias commands when called
alias ls='ls -vG'

之後按esc離開vi編輯器的編輯模式,接著打:wq完成存檔。

步驟三、關掉端端機,重開後即可。

輸入ls後,會發現資料夾變藍色了!

可參考
http://angelaixia.pixnet.net/blog/trackback/0e3dba4b2d/56334620

—–

alias ls=’ls -vG’的v是在iterm裡可顯示中文; G是可顯示顏色

LSCOLORS是在設定顏色的值

a -> black

b -> red

c -> green

d -> brown

e -> blue

f -> magenta

g -> cyan

h -> light grey

A -> bold black, usually shows up as dark grey

B -> bold red

C -> bold green

D -> bold brown, usually shows up as yellow

E -> bold blue

F -> bold magenta

G -> bold cyan

H -> bold light grey; looks like bright white

x -> default foreground or background

排列順序的屬性如下:

1. directory

2. symbolic link

3. socket

4. pipe

5. executable

6. block special

7. character special

8. executable with setuid bit set

9. executable with setgid bit set

10. directory writable to others, with sticky bit

11. directory writable to others, without sticky bit