how can i find number of lines in files & subdirectories

how can i find number of lines in files & subdirectories ?

for a file:

wc -l filename

I'm presuming by "a directory" you mean "sum of lines for all files in a directory". If you don't want to include subdirectories:

cat dir/* | wc -l

If you do:

find dir -type f | xargs cat | wc -l
1 Like
find . -type f -exec wc -l {} \;

You can get the summary lines for each file under current folder and subfolders.

@Corona688 Thanks