CLICOLOR and LS_COLORS in bash

There are several different implementations of color for ls, and you've conflated some of them.

  • On FreeBSD and Mac OS X, ls shows colors if the CLICOLOR environment variable is set or if -G is passed on the command line. The actual colors are configured through the LSCOLORS environment variable (built-in defaults are used if this variable is not set). To show directories in light blue, use

    export LSCOLORS=Exfxcxdxbxegedabagacad
    
  • With GNU ls, e.g. on Linux, ls shows colors if --color is passed on the command line. The actual colors are configured through the LS_COLORS environment variable, which can be set with the dircolors command (built-in defaults are used if this variable is not set).


What's it for CLICOLOR and LS_COLORS? Why coloring works without LS_COLORS?

CLICOLOR will turn colors on or off. LS_COLORS is not required, and will let you customize the colors.

Note that on some operating systems (Like MacOSX and FreeBSD), the value is named LSCOLORS, not LS_COLORS.

I avoid setting the color using LS_COLORS, because then I need to apply that same color scheme on a hundred different computers and 10 different Un*xes. Instead, I modify the color in my Terminal program, which works the same on most Unix hosts.


If you want a wrapper script for ls that works on all systems, abstracting away these color differences etc. see: http://www.pixelbeat.org/scripts/l