Fandom

How To Wiki

How to count the total number of lines in multiple files using a bash script

1,795pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.




Method 1 Edit

awk 'END {print NR}' *.java

Method 2 Edit

wc -l *.php

For windows Command line:



for %G in (*.sql) do find /c /v "_+_" %G

For linux Command Line:

wc -l *.sh

Method 3 Edit

cat *.java | wc -l

Method 4 Edit

Using find to generate a list of files, useful when files are in sub directories.

wc -l `find -name '*.java'` 

Also on Fandom

Random Wiki