How to find broken soft links in a directory?

How to find broken symbolic links in a directory which have many symbolic links?

asked Mar 5, 2014 by Lucy (990 points)

1 Answer

 
Best answer

Use this command to find broken soft links:

find -xtype l /path/to/dir/to/find/in/

You can also specify the action by -exec. For example, delete the soft links that are broken in the current directory:

find -xtype l -exec rm -f {} \;

Not /path/to/dir/to/find/in/ specified here, which means . (the current directory).

answered Mar 5, 2014 by Eric Z Ma (44,280 points)
selected Apr 1, 2014 by Lucy

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...