by default, gls/ls --color prints the directory name using a rather dark blue foreground. i
use a black terminal...i think most people do too. i find this to be quite unreadable.
it's a lot easier to read giving it a blue background and a white foreground.
dircolors (or gdircolors if you're using macports) is provided by the GNU coreutils package. it's reads
in a config file, prints out a variable and exports it.
% dircolors /path/to/my/config
LS_COLORS='no=00:fi=00:di=01;44;37:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:
mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:
*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.svgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:
*.lzma=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.bz2=01;31:*.tbz2=01;31:
*.bz=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:
*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:
*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:
*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:
*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:
*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:
*.xwd=01;35:*.yuv=01;35:*.svg=01;35:';
export LS_COLORS
except without the line breaks. the idea being that you call
eval `dircolors /my/config/file`
somewhere in your shell initialization. gls (also from coreutils) consults this environment variable when
you call 'gls --color' (or just 'gls' or even 'ls' if you have those aliases, which most people do).
the example LS_COLORS above was generated from dir_colors.txt, also in this gist. i think the only
non-standard line here is
DIR 01;44;37 # directory
by default, it says
DIR 01;34 # directory
which gives you the unreadable blue foreground.
copy the contents of dir_colors.txt to /etc/DIR_COLORS
older versions of coreutils (the one i've seen this in is 6.9) read the system-wide configuration from that location. i find this extremely convenient. if you have an older version of coreutils (like the one that ships with Fedora 8), you're done.
if you don't, add this to your /etc/profile
eval `dircolors /etc/DIR_COLORS`
if you prefer to this on a per-user basis, simply place that eval statement somewhere in that users'
shell initialization. the DIR_COLORS file can go anywhere and be called anything.
DUNZO