Re: find dangling symlinks

On 6/20/06, Johannes Zellner <johannes@xxxxxxxxxxx> wrote:
how do I find dangling symlinks?

$ find -L <path> -type l

should do it. "-L" tells find to follow symlinks, and "-type l"
(that's a lowercase ell) matches symlinks. Since the only symlinks
that will show as symlinks when they're automatically dereferenced are
ones pointing to nothing, you should get a list of dangling links.

I tested this out, and it worked as desired, but it's possible that
there might be cases where it breaks. In particular, long chains of
symlinks break, and I haven't checked to see if those match.

Michael A. Marsh

To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx