Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can I have automatic color output for ls if my TERM environment variable is set to xterm-256color?

share|improve this question
up vote 3 down vote accepted

If you are using bash, you could add export CLICOLOR="YES" to your ~/.bashrc.

share|improve this answer
GHAAAAA! I set the variable up wrong! I set it to CLICOLORS! – CyberSkull May 23 '13 at 21:25
You can also make use of the LS_COLORS var to customize the colors – demure May 23 '13 at 21:27

Just for the sake of anyone who might come along and wonder how to restrict this to only when the TERM is a certain value, you could put something like this in your shell's "rc" file (.zshrc or .bashrc etc):

case "$TERM" in 

        export CLICOLOR="YES"

        export CLICOLOR="YES"

        export CLICOLOR="NO"


Note that the 2nd example is just there to show why you might want to use 'case' instead of 'if/then': the ability to use wildcard matching and use multiple entries separated by |

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.