Any single file you create is arguably a hard link on any *nix so far as I’m aware. It’s why basic files within a directory should have a link number of 1. You could create a new directory and add three files but the directory itself .
typically has 2 links listed under ls -l
(itself and the parent) whereas the files aren’t included in the “hard-link” count for a directory (it’s still 2 for the directory not 5).
There’s something we’re both missing here and I’d hazard a guess it’s something to do with OSX but off the top of my head I’m not sure what it is. OSX has a slightly different ls
command to gnu linux so you can check the man
page but I’m not sure that’s the cause of the count. If I had to guess it’s something to do with an automatic indexing or linking that OSX performs by default but that’s just a guess.
I don’t have access to OSX at the minute so I’m afraid I can’t test it. I wouldn’t worry about it overly at this point, there are arguably better ways to count the number of files/directories. If you’re determined to find out then looking up the right tools/commands to check for links would probably be the way to go.