Considere a seguinte estrutura de diretório:
lrwxrwxrwx [...] a -> target1
lrwxrwxrwx [...] c -> target1
lrwxrwxrwx [...] m -> target2
lrwxrwxrwx [...] n -> target3
lrwxrwxrwx [...] t -> z
-rw-r--r-- [...] target1
-rw-r--r-- [...] target2
-rw-r--r-- [...] target3
lrwxrwxrwx [...] z -> target1
Use o GNU find para encontrar todos os arquivos apontando para o mesmo inode:
find -L . -samefile target1
-
-Lsegue links simbólicos, mesmo se você tiver links simbólicos recursivos -
-samefilelocaliza todos os arquivos que apontam para o mesmo inode que o dado parâmetrotarget1
A saída no diretório acima ficaria assim:
./z
./a
./target1
./c
./t