If you’ve used Terminal.app, you’d notice that it’s a bit boring that their linux counterparts due to the lack of file and directory colors. Adding 2 lines in your ~/.bash_profile file will add a little color to your boring Terminal.
Open ~/.bash_profile, using vi or vim or whatever, and add these two lines:
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
Save the file, quit Terminal, open it again, then do an “ls”. You now have file and directory colors/highlights enabled!
If you want to change to a different color, note the 2nd line you added. Each pair of characters denotes the foreground color and background color for a specific type of file or directory. For example, the first pair, “Ex” means that the foreground color is “E” (which is Bold Blue) and the background is “x” (which is the default background set by Terminal preferences).
Here are the order of pairs in the LSCOLORS parameter:
- Directory
- Symbolic link
- Socket
- Pipe
- Executable
- Block special
- Character special
- Executable with setuid bit set
- Executable with setgid bit set
- Directory writable to others, with sticky bit
- Directory writable to others, without sticky bit
And here’s the list of available colors:
- a black
- b red
- c green
- d brown
- e blue
- f magenta
- c cyan
- h light grey
- A block 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