|
mac geekeryGet your geek on. |
Interpreting Color "ls" OutputLaura asks: QuestionWhen you enter ls -G in the Terminal, what do all of the different colors and highlighting mean? I checked the man page, but unhappily for me I prefer plain English, so I’m still in the dark about the -G flag. AnswerAdmittedly, the ls documentation could be a little more clear about this. With a little work, though, we can figure it out. Under “LSCOLORS”, the manpage states that “The default is exfxcxdxbxegedabagacad”, and the above chart helps us figure out exactly what that means. We tend not to publish tips that come straight out of the documentation, but I’m quite frankly tired of having to stare at the odd format of the manpage and I’m writing this up as much for me as for you.
If you want to override any of this (which I’ve been pondering, considering the blue of a directory is hard to read on my black terminal windows), you need to set the LSCOLORS environment variable. If you’re one of the Chosen Children Of The Bearded UNIX God1, you would do something like this to set dirs to magenta and leave everything else alone. export LSCOLORS=exfxcxdxbxegedabagacad 1 read: a bash-user. About JC |
|
On my Mac the suggested code makes the directories blue. If you want magenta (blech!) directories use:
export LSCOLORS=fxgxcxdxbxegedabagacad
My preferred format is Green & Gold (Aussie, Aussie, Aussie!):
export LSCOLORS=dxfxcxdxbxegedabagacad
Cheers!
... and people wonder why Unix isn’t on everyone’s desktop computer?
informative article though
In all fairness, this is the kind of crap interface the GNU folks added to the tool. The original didn’t even have a color mode to begin with.
Are you sure the “ls” binary in OS X is GNU software? It doesn’t appear to accept the standard —version specifier and doesn’t contain any references to GNU.
The GNU ls uses “LS_COLORS” instead of “LSCOLORS” and the format is a bit better. For example, to change my directory color to white, I just set:
LS_COLORS=‘di=01;37’
di = directory
01;37 = ansi color code for white
I personally use the GNU ls on my system
This story’s fun. I’ll make it short, though. GNU added it to their ls, and then BSD wanted it and added it to their own ls, using the same commands to make it semi-compatible. Or so I hear. I could have heard wrong, but it’s just the kind of horrible interface I expect from GNU software so I’m tempted to believe it.
I prefer -F, —classify append indicator (one of */=>@|) to entries