Skip to content

Finding Broken Symbolic Links

Introduction

After a few years on heavily used servers, especially those with many users, you may end up with broken symbolic links. Here's a solution to find them all at once.

Usage

To search for all broken links:

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

And to delete them in the same operation:

find . -type l ! -exec test -e {} \; -print0 | xargs -0 rm