How to Color Code Mac OS Lion’s “Ls” Command

|

Stick this into your shell’s rc file. If you use bash, .bashrc. I use zsh, so .zshrc.

1
2
3
4
5
6
7
8
9
# make ls display colors, reinforce with CLICOLOR and LSCOLORS
export CLICOLOR=1

# LSCOLORS order: DIR, SYM_LINK, SOCKET, PIPE, EXE, BLOCK_SP
# CHAR_SP, EXE_SUID, EXE_GUID, DIR_STICKY, DIR_WO_STICKY
# a = black, b = red, c = green, d = brown, e = blue,
# f = magenta g = cyan, h = light gray, x = default
# lowercase is bold
export LSCOLORS=gxex

This particular LSCOLORS configuration makes directors bold cyan and sym links dark blue. All the rest are default.