shell - Fast Linux file count for a large number of files
I'm trying to figure out the best way to find the number of files in a particular directory when there are a very large number of files (more than 100,000).

By default ls sorts the names, which can take a while if there are a lot of them.  Also there will be no output until all of the names are read and sorted.  Use the ls -f option to turn off sorting.
ls -f | wc -l

Note: This will also enable -a, so ., .., and other files starting with . will be counted.
