How to find broken soft links in a directory?

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

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).

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *