shell: "ls --color" colorize broken symlinks differently
Posted: Thu Mar 31, 2011 2:34 pm
[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:
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.
"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`