Find broken symlinks

I’m going to make some directory moving and it will break some symlinks.  So, I need to find out those broken symlinks and update them accordingly.  After some googling, I found a nice and easy way:

find . -type l | while read i ; do test -e $i || ls -l $i; done

The command not only show you the broken symlinks but also the missing destination file (or directory, etc).

One response to “Find broken symlinks

  1. name July 22, 2010 at 6:36 am

    or:

    find -L /directory -type l

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: