LSCOLORS/LS_COLORS: Now with Linux Support

A while back I made a little web page to spruce up ls output. Of course I completely forgot about it until recently. Some of Ubuntu’s default colors were hard to see in, so I added mostly-working LS_COLORS for Linux. The string format is completely different, and harder to go from text to preview, so I ditched that feature. Linux people will have to copy-paste the color string and type ls in their terminals. Life’s tough, I know.

Anyway, try it out.

Once you’ve got a theme you like, try the following for BSD/OS X:

alias ls="ls -G"

or on Linux:

export LS_COLORS
alias ls="ls --color"

Apparently just setting an environment variable called LS_COLORS doesn’t mean you actually want ls to print in color. You have to set up the aliases as well. Add the lines above to ~/.bash_profile (or .profile if you’re a ksh user) to make the change permanent.

One thing I learned: Linux’s color string is much more powerful than BSD’s. Linux’s ls lets you choose more colors, blinking text, and backwards text. It even lets you specify color settings for specific file extensions in addition to general types of files. Support for all those extra features will have to wait until forever. I use color information sparingly. Too many colors is just as useless as no color. If you want to get fancy, this guy has some helpful info.

When commenting, remember: Is it true? Is it necessary? Is it kind?