4 ms·
If you have GNU find, find . -mindepth 1 -maxdepth 1 -printf x | wc -c performs about the same and includes dotfiles (not "." or "..", though) in the count.
by l0b0 3y ago
If you have GNU find,
find . -mindepth 1 -maxdepth 1 -printf x | wc -c
performs about the same and includes dotfiles (not "." or "..", though) in the count.