by antongribok · 2y ago · 0 comments
ls -U1 |wc -l
Can be very fast with lots of files on a modern Linux box. -U: do not sort; list entries in directory order find . -mindepth 1 -maxdepth 1 -printf x | wc -c
performs about the same and includes dotfiles (not "." or "..", though) in the count.