Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

Trying to get --color=auto as the default ls argument.

$  ls --version
ls (GNU coreutils) 8.21
$  echo $LS_COLORS
$  echo $LS_OPTIONS

Unfortunately when I run ls I still get non-colored output (running ls --color=auto manually gives me colors).

How do I make --color=auto a default ls argument?

share|improve this question
Is ls aliased with different options? Try 'type ls' to see if it is aliased. \ls should run the unaliased ls. – jaychris Nov 6 '13 at 5:11
Thanks, but all I get there is an absolute path to the ls I installed to $HOME\opt\bin\ls – A T Nov 6 '13 at 13:46
up vote 0 down vote accepted

I think you might have thought that GREP_OPTIONS being supported implies that LS_OPTIONS would be too, as in:

This is not the case though, so you're best doing something like this in your bashrc or equivalent:

alias ls='ls --color=auto'
share|improve this answer
I heard that using alias where an environmental variable can be given instead isn't recommended… all well, it's working now – A T Nov 8 '13 at 3:47

It isn't enough to just set $LS_OPTIONS as a bash variable; you must also export it to the environment so that child processes pick it up as well.

$ export LS_OPTIONS
share|improve this answer
I set the environment variables using LS_OPTIONS="--color=auto" notation in .bash_profile. I tried adding export lines there also (after your answer); but that didn't make a difference. – A T Nov 6 '13 at 4:02

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.