I want to count all .class
file in my project directory. I am working on ubuntu. I can list all the class file like this –
find . -type f -name '*.class'
It lists a lot of .class
files. But I want to know the count of these .class
files. Is there any way to do this in linux.
Thanks.
Advertisement
Answer
Use wc -l
.
wc
stands for “word count”, and its -l
flag makes it count lines.
Since your command outputs a line per file1, counting lines means counting files.
find . -type f -name '*.class' | wc -l
1 please note @chepner’s comment