It really helps me to see different types of entries in the Terminal listed with different colors. I don’t go for listing everything that you can list as a different color though, as it starts looking a bit like a circus in Terminal when I do. If you want to colorize your terminal in Mac OS X there are two main ways to do so; both will require altering your .bash_profile (or creating if it’s not already there).
To get started, go to your home folder from within Terminal and open .bash_profile from your favorite text editor. If it doesn’t exist then the text editor should create a new file when you save it. Now that you’ve created the .bash_profile paste these two lines in there:
export CLICOLOR=1
export LSCOLORS=ExxxxxDxBxegedabxxacad
The above export can be seen as having two aspects. The first is the position. There are a total of 11 positions, with a foreground and a background being listed in that order, for each position, resulting in 22 total letters. The following represents each position, in sequence:
- Directory
- Symbolic link
- Socket
- Pipe
- Executable
- Special block
- Special character
- Executable w/ setuid set
- Executable w/ setgid set
- Directory that is writable to others w/ sticky bit
- Directory that is writable to others w/out sticky bit
Next, consider the colors that are used. These include:
- a black
- b red
- c green
- d brown
- e blue
- f magenta
- g cyan
- h light grey
- x default foreground or background
Additionally, each of these colors can be used in upper case, resulting in a bold version of the same color. So if we want everything else listed with the default colors except for directories and we wanted those listed in red, we could use the following LSCOLORS line:
export LSCOLORS=bxxxxxxxxxxxxxxxxxxxxx
Now let’s say that we’re going to have our executables listed in blue, directories in red and everything else in the default colors:
export LSCOLORS=bxxxxxxxexxxxxxxxxxxxx
export LSCOLORS=bxxxxxxxexBxxxxxxxxxxx