6

Does find -links count the hard links or symbolic links ?

find -links 2

1 Answer 1

9

Hard links. That's the only type for which its even possible to count. Pretty much every find option is something fairly trivially obtained for each file; the hard link count comes from stat (and is also displayed by ls, by the way).

(To count symlinks, you'd have to examine every symlink and check where it points. But that's not even possible—symlinks can cross filesystems, and all of them may not be mounted. Or could be mounted in different locations, which could leave the symlinks pointing the different things. You could count only the ones in the files find searches through, but that's very non-trivial for a file match flag.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .