Display a Count of Files in the Current Directory

From HowToGeek

Jump to: navigation, search

If you want to get a count of how many files are in a specific directory, you can do so easily with a simple command.

This command uses the -1 (that's a one) parameter of ls to display each file on a new line, and then the -l (lowercase L) parameter of the wordcount (wc) utility.

ls -1 | wc -l

Idea thanks to Adam Pash.