Finding Infinite Symlink Loops

Sometimes you can find yourself in symlinking hell when you’ve inadvertently created a loop of links, where link A refers to file B, and file B is another link back to A, for example.

You can use the GNU version of ‘find’ to discover where the link loops are. This information is from a bug report here.

Note that this doesn’t work if you have version 4.2.19 of find. You can check the version with rpm, assuming you are using an rpm-based Linux distribution (RedHat anything, CentOS, etc.).

‘rpm -q findutils’ should show the current version.

find . -follow

find: Symbolic link 'some/path/or/another' is
part of a loop in the directory hierarchy;
we have already visited the directory to which it points.

Once you have found the location of the loop you can manually fix things :-)

Leave a reply

You must be logged in to post a comment.