본문 바로가기

Macintosh

ls명령어 색깔 입히기!

자신의 home 폴더에 있는 .bash_profile에 다음 라인을 추가하자.
alias ls="ls -G"
이렇게 설정하고나면, ls할때, 색이 자동으로 입혀져 나온다.

색이 마음에 안든다면??
.bash_profile에 다음 라인을 추가하자.
export CLICOLOR=1
export LSCOLORS=exfxcxdxbxegedabagacad
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 yellow
E bold blue
F bold magenta
G bold cyan
H bold light grey, looks like bright white
x default foreground or background
를 의미한다.
그렇다면, 순서는 무엇을 의미할까? 2개씩 끊어서
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
각각 foreground, background를 나타낸다.

excutable의 색을 cyan으로 바꾸고 싶다면,
LSCOLORS의 9번째 글자를 g로 바꿔주면 된다.