ls -1 | wc -l
*NOTE: ls -1 will list all files one per line, afterwards we pipe the results to wc which will count the lines and thus the total number of file.
It is up to the user to modify the ls in such way that it will perform more complex operations.
This post is also available in: Αγγλικα