find <dir> ! -type d -links +1 -ls|sort -n
this will print all hardlinks in specified directory, sorted by files i-node.
the ! -type d is to avoid directories.
The -links +1 will find all files that have MORE than 1 link. Hardlinked files have a link count of at least two.
The -ls is used to view the
inode number after find has found the file.
- The sort -n will sort the list by
inode number showing you which files are hardlinked together.
This will only work if your search includes the directories that contain all of the hardlinked files.
here is anotherway
f=`ls -i $srch_arg |awk '{print $1}'`
find / -inum $f
this will search all system and print any files that is hardlinked with $srch_arg
[Edited by mib on 03-25-2001 at 06:05 AM]