I spend most of my time working in Unix environments and using Terminal emulators. I try to use color on the command-line, because color makes the output more useful and intuitive.
What are some good ways to add color to my terminal environment? What tricks do you do? What pitfalls have you encountered?
Unfortunately, support for color is wildly variable depending on terminal type, OS, TERM setting, utility, buggy implementations, etc.
Here's what I do currently, after a lot of experimentation:
- I tend to set
TERM=xterm-color, which is supported on most hosts (but not all). - I work on a number of different hosts, different OS versions, etc. I'm trying to keep things simple and generic, if possible.
- Many OSs set things like
dircolorsand by default, and I don't want to modify this on a hundred different hosts. So I try to stick with the defaults. Instead tweak my Terminal's color configuration. Use color for some unix commands (
ls,grep,less,vim) and the Bash prompt. These commands seem to the standard "ANSI escape sequences". For example:alias less='less --RAW-CONTROL-CHARS' export LS_OPTS='--color=auto' alias ls='ls ${LS_OPTS}
I'll post my .bashrc and answer my own question Jeopardy Style.
