I have not found a reason why Mac's find does not have the option -printf. Apple normally decides to take options out which are not orthogonal to the other commands?
How can you reach the same result as the following command in Mac without coreutils?
find . -printf "%i \n" // command in Ubuntu
It's not that Apple removes options, it's that OS X's UNIX underpinnings are mostly derived (circuitously) from FreeBSD, many parts of which can be traced back to the original UNIX... as opposed to the GNU utilities, which are re-implementations with many features added.
In this case, FreeBSD's find(1)
doesn't support -printf
, so I wouldn't expect OS X's to either. Instead, this should work on a BSD-ish system:
find . -print0 | xargs -0 stat -f '%i '
It'll fail on a GNU-userland system, though, where you'd write xargs -0 -r stat -c '%i '
because xargs(1)
and stat(1)
behavior is different.