[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: find dangling symlinks



On 6/20/06, Johannes Zellner <johannes@zellner.org> 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
http://www.umiacs.umd.edu/~mmarsh
http://mamarsh.blogspot.com



Reply to: