Discussion:
ls color for bad symbolic link
(too old to reply)
Tong
2004-12-11 22:10:13 UTC
Permalink
Hi,

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.

How can I do that in Debian? Thanks

tong
--
To UNSUBSCRIBE, email to debian-user-***@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact ***@lists.debian.org
Adam Aube
2004-12-11 22:40:10 UTC
Permalink
Post by Tong
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.
Edit your .bashrc and uncomment this line:

alias ls='ls --color=auto'

Then run:

'. .bashrc'

Adam
--
To UNSUBSCRIBE, email to debian-user-***@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact ***@lists.debian.org
Maurits van Rees
2004-12-11 22:50:08 UTC
Permalink
Post by Tong
Hi,
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.
How can I do that in Debian? Thanks
ls --color=auto

You can set
alias ls='ls --color=auto'
in you .bashrc if you want this to be the standard next time you login.

`vdir' may already have been setup to use colors. Try it.

You can set it up differently. Type
echo $LS_OPTIONS
and
echo $LS_COLORS
and experiment in .bashrc or other bash config files if you feel like
it.

Good luck,
--
Maurits van Rees | http://maurits.vanrees.org/ [Dutch/Nederlands]
Public GnuPG key: keyserver.net ID 0x1735C5C2
"Let your advance worrying become advance thinking and planning."
- Winston Churchill
Tong
2004-12-15 00:30:19 UTC
Permalink
Post by Tong
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.
How can I do that in Debian? Thanks
Thanks everyone for the respond... yet I'm still looking for the answer
that I want -- the fact is I have no problem showing colors using ls. Just
need to distinguish bad symbolic link from good ones.

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.
--
To UNSUBSCRIBE, email to debian-user-***@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact ***@lists.debian.org
Ron Johnson
2004-12-15 00:40:09 UTC
Permalink
Post by Tong
Post by Tong
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.
How can I do that in Debian? Thanks
Thanks everyone for the respond... yet I'm still looking for the answer
that I want -- the fact is I have no problem showing colors using ls. Just
need to distinguish bad symbolic link from good ones.
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.
Console or an xterm?
--
-----------------------------------------------------------------
Ron Johnson, Jr.
Jefferson, LA USA
PGP Key ID 8834C06B I prefer encrypted mail.

"Object-oriented programming is an exceptionally bad idea which
could only have originated in California."
Edsger Dijkstra
Michael Marsh
2004-12-15 01:00:09 UTC
Permalink
Post by Tong
Thanks everyone for the respond... yet I'm still looking for the answer
that I want -- the fact is I have no problem showing colors using ls. Just
need to distinguish bad symbolic link from good ones.
Check out "info dircolors". Specifically, from the compiled-in
defaults after running "eval `dircolors`" and typing "ls --color"
(which I usually don't use), a good link shows up in cyan while a bad
link shows up as red on black.
--
Michael A. Marsh
http://www.umiacs.umd.edu/~mmarsh
--
To UNSUBSCRIBE, email to debian-user-***@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact ***@lists.debian.org
Jason Chambers
2004-12-15 01:00:13 UTC
Permalink
Post by Tong
Post by Tong
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.
[snip]
Post by Tong
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 <***@thingy.org.uk>
: :' : Registered linux user #271693
`. `'`
`- http://www.debian.org/ - The Universal Operating System
Tong
2004-12-16 17:50:08 UTC
Permalink
Post by Jason Chambers
Post by Tong
Post by Tong
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.
[snip]
Post by Tong
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.
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.
--
To UNSUBSCRIBE, email to debian-user-***@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact ***@lists.debian.org
Wayne Topa
2004-12-16 21:20:10 UTC
Permalink
Post by Tong
Post by Jason Chambers
Post by Tong
Post by Tong
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.
[snip]
Post by Tong
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.
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.
I have had this snippit in my .bash_profile for 10-12 years.

# set up the color-ls environment variables:
if [ "$SHELL" = "/bin/zsh" ]; then
eval `dircolors -z ~/.dircolors`
elif [ "$SHELL" = "/bin/ash" ]; then
eval `dircolors -s ~/.dircolors`
else
eval `dircolors -b ~/.dircolors`
fi

Hope this helps somone.

WT
--
Every time I type 'win', I loose ...
_______________________________________________________
--
To UNSUBSCRIBE, email to debian-user-***@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact ***@lists.debian.org
Loading...