Here’s how to colorize output from the ls command in OS X Terminal.
Edit ~/.bash_profile and add the following two lines:
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
This will generate output with the following color scheme:
- directory: bold blue, default foreground or background
- symbolic link: bold magenta, default foreground or background
- socket: bold green, default ” or ”
- pipe: bold brown (usually shows up as yellow), default ” or ”
- executable: bold red, default ” or ”
- block special: blue foreground, cyan background
- character special: blue, brown background or foreground
- executable with setuid bit set: black foreground, red background
- executable with setgid bit set: black foreground, cyan background
- directory writable to others, with sticky bit: black foreground, green background
- directory writable to others, without sticky bit: black foreground, brown background


For those of you who really want to know what this means, here’s some information taken directly from the man page for ls.
LSCOLORS: The value of this variable describes what color to use for which attribute when colors are enabled with CLICOLOR. This string is a concatenation of pairs of the format fb, where f is the foreground color and b is the background color.
The color designators are as follows:
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 backgroundThe order of the attributes are as follows:
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
January 28th, 2007 at 5:32 pm
Heh, looks like your Linux experience should be a big plus now.
January 29th, 2007 at 8:52 am
This is true. Now I can ls until my heart is content
.