linux – find hard links

If you want find all hard linked files recursively:

touch file1
ln file1 file2
ln file1 tmp/file3

find . -xdev -samefile file1

./file2
./file1
./tmp/file3

Leave a Reply

Your email address will not be published. Required fields are marked *