I know that a similar question has been asked in:
although I didn't really understand the answer and couldn't really make it work.
However, I have tried something different. I decided to read the manual page for ls
and it mentions different environment variables that can be set when dealing with the ls
command. If one goes to the -G
option it says to look at the CLICOLOR
environment variables. I did and that one links you to documentation for the LSCOLORS
environment variable. I went to it and it mentions:
"The value of this variable describes what color to use for which attribute when colors are enabled with CLICOLOR. This string is a concatenation of pairs of the format fb, where f is the foreground color and b is the background color. "
It also mentions that the default value of LSCOLORS is "exfxcxdxbxegedabagacad" and that each part specifies the color of some specific thing in the ls command. For example, the first pair ex in example specifies the color of directories. the second fx the color of symbolic links etc... e means blue and x means default "foreground".
1) First what does this mean: "when colors are enabled with CLICOLOR"?
2) What does "foreground" mean?
What must environment variables be for the ls
command to color the output however I desire?
I also tried:
ls --color
But it threw me the following error:
ls: illegal option -- - usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...]
The same error happened when I did ls --color=auto
: it alone also throws an error. I have no idea why, and am not sure if it was due to iTerm2 or OS X or why that happened. It seems it works on other systems...
ls -G
along the lines of the answer you have below. Yes it's like BSD ls on OSX so there is no --color=auto option with that. Don't even know if something like a local dircolor file works.