ls
Try:
ls -b1A | wc -l
The -b will haveescape non-printable characters, -A will show all files except . and .., and one per line (the default on a pipe, but good to be explicit).
Python
As long as we're including higher-level scripting languages, here's a one-liner in Python:
python -c 'import os; print (len(os.listdir(os.sep)))'
Or with full 'find':
python -c 'import os; print (len([j for i in os.walk(os.sep) for j in i[1]+i[2]]))'