ls color for bad symbolic link 

Newsgroups:  gmane.linux.debian.user
Date:        Wed, 15 Dec 2004 00:51:22 +0000
> > I remember that my previous distro can distinguish symbolic links as good
> > or bad: good links are show as normal link color whereas bad links are
> > shown as red.
> Ok, let's take a look at an example:
>
> touch a
> ln -s a l1
> ln -s no l2
> rm no
>
> ls --color=auto
>
> Do l1 and l2 show up in same color?
>
> In my Debian, they are, but in my RH, l2 show up red.

Have you tried doing a eval `dircolors -b` before the ls command? This defines the LC_COLORS variable that is used to decide what colours are used. You can get pretty colours for all sorts of things if you want to play about with dircolors but by default broken links are in red, and common image file extension in magenta etc.

IIRC it was already in the bashrc file - it just needed uncommenting.

Jason Chambers

ls color for bad symbolic link 

Thank you very much Jason!

Of all the replies, only yours give the correct answer to my problem.

Just for the archive, as the result, before the eval, both my l1 and l2 are in magenta, whereas after the eval, l2 show up red.

T

documented on: 2005.01.15