Counting files in a directory

To count files in a directory use te following command:

ls -1 | wc -l

The option to the ls command is a 1 (one), the option the wc command is a lowercase L.

Back to GNU/Linux Command Line Tips