Skip to content

Instantly share code, notes, and snippets.

@dprea
Created January 22, 2016 04:27
Show Gist options
  • Save dprea/4f7a3ec641e6f8e033b2 to your computer and use it in GitHub Desktop.
Save dprea/4f7a3ec641e6f8e033b2 to your computer and use it in GitHub Desktop.
Linux Commands - Count Files in directory
$ find . -type f | wc -l

Explanation: find . -type f finds all files ( -type f ) in this ( . ) directory and in all sub directories, the filenames are then printed to standard out one per line.

This is then piped | into wc (word count) the -l option tells wc to only count lines of its input.

Together they count all your files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment