blog.up-link.ro
24Nov/110

UNIX Tips: How to find broken symbolic links

In computing, a symbolic link (also symlink or soft link) is a special type of file that contains a reference to another file or directory in the form of an absolute or relative path and that affects pathname resolution.

1. To display a list of the broken links, execute:

find -L ${dir} -type l

2. To remove the broken links, execute:

find -L ${dir} -type l -print0 | xargs -0 rm
Do not forget to replace ${dir} with the desired directory.

Print This Post Print This Post