0

I need to find hardlink files under specific folder in Solaris. Tried this below command which lists the files based on inode count.

find . -type f -links +1

The above command list both source and target files. But i need to list only the target_file. For Eg: Under Test folder, there is source.txt

Test

->source.txt

Created hardlink: ln source.txt target.txt

The above find command return both source.txt and target.txt. But I need a command to fetch only target.txt. Is it possible?

1 Answers1

0

No. After the hardlink both names of the file are equal in all ways, there is no original or copy.

Since they share the underlying inode, both files have the same attributes -- change one you change all of them.

Either switch to symbolic links or find a heuristic to choose which one you don't want to see, like it has an extension, or sorts later.

fork2execve
  • 1,561
  • 11
  • 16