shell: "ls --color" colorize broken symlinks differently

Linux howto's, compile information, information on whatever we learned on working with linux, MACOs and - of course - Products of the big evil....
Post Reply
User avatar
^rooker
Site Admin
Posts: 1483
Joined: Fri Aug 29, 2003 8:39 pm

shell: "ls --color" colorize broken symlinks differently

Post by ^rooker »

[PROBLEM]
"ls --color" is able to display symbolic links that point to an invalid target to be shown in a different color (e.g. red), than valid symlinks (e.g. green). That's great.

The problem now is, that for example, on a Debian Lenny, invalid symlinks are displayed in the same color as valid ones. :(


[SOLUTION]
Thanks to some short hint by an article on xpt.sourceforge.net, I found that it's as simple as issuing:

Code: Select all

`dircolors -b`
NOTE: The backtick-quotes are important. They execute the output of the command "dircolors -b" and set the environment variable "LS_COLORS" to meaningful values.
Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
Post Reply