Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Change 'ls' directory colors' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Change 'ls' directory colors
Authored by: jimr on Mar 19, '03 09:24:14AM

Jennifer (jyncroft) is right. or for the adventurous, compile the Gnu fileutils 4-1. It is easy, and will give you some experience compiling (with the Dev tools installed and with the idea that you might want to discover what the package installs and then backup all your old utils first).

All of the comments on this add up to the fact that:


As far as I know... the version of ls which ships with Mac OS X does not support the 'color=auto' command which you need to invoke when you are using ls. The version in the GNU tools ( search for fileutil in google ) includes that capability. This information has been provided in some hints previously on this web-site.

Fileutils also includes a small script that you can use to automatically set your environment variable it is called DIRCOLORS and you can make it executable and then setenv LS_COLORS 'path/to/DIRCOLORS'

this is desirable because a nice set of color choices may end up being a very long list.
here is a sample from my environment.mine (there is a hint about that too!!!) where I am not using the DIRCOLORS but obtained some of the information from there and then wrote the infor in multiple lines as follows:

each setenv LS_COLORS "XXXX:XXXX" should be on one line!!!

setenv LS_COLORS "no=00:fi=00:di=09;33:ln=04;34:pi=04;33:*.dylib=04;03;31"
setenv LS_COLORS "${LS_COLORS}:so=01;35:bd=03;32;03:cd=03;34;02:or=30;01;31"
setenv LS_COLORS "${LS_COLORS}:ex=03;36:*.tar=04;03;32:*.tgz=04;03;32"
setenv LS_COLORS "${LS_COLORS}:*.arj=01;31:*.taz=01;31:*.lzh=01;30"
setenv LS_COLORS "${LS_COLORS}:*.zip=35;01;30:*.z=01;31:*.Z=01;30:*.gz=04;03;32"
setenv LS_COLORS "${LS_COLORS}:*.d*=01;30:*.jpg=01;35:*.gif=04;32"
setenv LS_COLORS "${LS_COLORS}:*.pl=06;31:*.ppm=01;35:*.tga=01;35"
setenv LS_COLORS "${LS_COLORS}:*.xbm=01;35:*.xpm=01;35:*.ti*=01;34"
setenv LS_COLORS "${LS_COLORS}:*.txt=09;33:*.pdf=02;36:*.gl=03;37:*.dl=01;37"
setenv LS_COLORS "${LS_COLORS}:*.mine=03;36:*.html=02;34:*.cgi,*.?html=03;34"

If you just want to get away from the default blue for directories try to find the correct way for your shell in the other comments in this section.

so find a copy of color_ls (for example: -HERE- and check which shell you are using and you too, can have an easy to read terminal display. you will need to change the name to ls!!!! (also, sometimes my router takes a little walk in the park....)


[ Reply to This | # ]