search by tags

for the user

adventures into the land of the command line

changing the ls colour scheme

in linux, ls colors are configured with the LS_COLORS environment variable. add these lines to your ~/.bash_profile file

### Set the ls colour scheme
alias ls="ls --color=auto"
LS_COLORS="di=31;1:ln=93;1:ex=32;1:*~=31;1"
export LS_COLORS

cheat sheet for what type of thing to colourise

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).

cheat sheet for the colours

#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
90  = dark grey
91  = light red
92  = light green
93  = yellow
94  = light blue
95  = light purple
96  = turquoise
#Background color codes:
40  = black
41  = red
42  = green
43  = yellow
44  = blue
45  = magenta
46  = cyan
47  = white
100 = dark grey
101 = light red
102 = light green
103 = yellow
104 = light blue
105 = light purple
106 = turquoise

with mac osx, ls colours are configured with the CLICOLOR environment variable. CLICOLOR will turn colors on(1) or off(0). LS_COLORS is not required, but will let you customize the colors if desired. add these lines to your ~/.bash_profile file

# ls colour scheme
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad

cheat sheet for the order of attributes for LSCOLORS

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

cheat sheet for the colours of 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