Since we work in Linux Operating system, often we need to see how many files inside a folder. Following is the command to count the files in a directory.
find DIR_NAME -type f | wc -l
More Details
-type f
to include only files.|
(and not¦
) redirectsfind
command’s standard output towc
command’s standard input.wc
(short for word count) counts newlines, words and bytes on its input (docs).-l
to count just newlines.
Did this post help you?
Tutsplanet brings in-depth and easy tutorials to understand even for beginners. This takes a considerable amount of work. If this post helps you, please consider supporting us as a token of appreciation:
- Just want to thank us? Buy us a Coffee
- May be another day? Shop on Amazon using our links.
Your prices won't change but we get a small commission.
Leave a Reply