find -links count the hard links or symbolic links ?
find -links 2
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
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.)