HOWTO Find broken symbolic links – Gentoo Linux Wiki

HOWTO Find broken links – Gentoo Linux Wiki

I was trying to find some broken links. however, although using
find . -type l

shows all links, it does nto use the cool flashing RED that BASH can do to shwo a broken links. So doing a quick Google turned me to this Gentoo howto: Nice n easy!
find . -type l | (while read FN ; do test -e "$FN" || ls -ld "$FN"; done)

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks

Technorati Tags:

March 4, 2007. Computergeekery, Tips, trivial shennanigans. Tags: . 9 Comments.

9 Comments

  1. Danny Rice replied:

    easier

    find -L . -type l -lname ‘*’

    April 13th, 2007 at 1:21 pm. Permalink.

  2. Ferg replied:

    thanks. Will try that.

    Cheers
    Ferg

    April 14th, 2007 at 6:24 pm. Permalink.

  3. Mark replied:

    This seems a bit more direct:

    find -L . -type l

    May 1st, 2007 at 1:11 am. Permalink.

  4. UniIsland replied:

    “find -L” follows sym links
    so it goes out of ./ dir

    October 22nd, 2008 at 11:58 am. Permalink.

  5. shell tip : identify broken symlinks - Tech@Sakana - A sysadmin’s blog replied:

    [...] to the “Ferg’s Gaff” blog (especially the comments) for showing the way [...]

    November 29th, 2008 at 7:58 pm. Permalink.

  6. osito replied:

    To also show what the broken links used to point to:
    find -L Documents -type l -ls
    - or -
    find -L Documents -type l -exec ls -l “{}” \;
    - or -
    find -L Documents -type l -exec ls -l –color “{}” \; ## colorized

    December 21st, 2008 at 7:22 am. Permalink.

  7. Selah replied:

    find -L . -type l
    gives me an error message:
    find: invalid predicate `-L’

    June 21st, 2009 at 6:45 pm. Permalink.

  8. The Mikeness replied:

    broken link search without pipe:

    find . -type l ! -execdir test -e ‘{}’ \; -print

    August 31st, 2009 at 10:06 pm. Permalink.

  9. The Mikeness replied:

    er, better off without the ‘ because your blog seems to turn it into the UTF-8 quotes:

    find . -type l ! -execdir test -e {} \; -print

    August 31st, 2009 at 10:07 pm. Permalink.

Leave a Reply

Trackback URI

Bad Behavior has blocked 367 access attempts in the last 7 days.