The find
command detects symbolic link loops and will print a warning message instead of traversing them repeatedly. For example, using the -L
option to follow symlinks may print this warning:
$ find -L /some/path
find: File system loop detected; `/some/path/link' is part of the same file system loop as `/some/path'.
From the man page:
The find utility shall detect infinite loops; that is,
entering a previously visited directory that is an ancestor of
the last file encountered. When it detects an infinite loop,
find shall write a diagnostic message to standard error and
shall either recover its position in the hierarchy or
terminate.