I once used a tool under Windows, the detailed introduction is here http://code.google.com/p/boomworks/wiki/SourceCounterCN
It can count data including: number of lines of code, comments, blank lines, file size, etc.
In addition, it also supports the analysis and prediction of manpower, costs, quality indicators, etc. at each development stage of the software development project.
Some are also introduced on the cloc website
Sonar
Ohcount
SLOCCount
sclc
USC's CODECOUNT
loc
cloc Basic Use
prompt> cloc perl-5.10.0.tar.gz
4076 text files.
3883 unique files.
1521 files ignored.
http://cloc.sourceforge.net v 1.50 T=12.0 s (209.2 files/s, 70472.1 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
Perl 2052 110356 130018 292281
C 135 18718 22862 140483
C/C++ Header 147 7650 12093 44042
Bourne Shell 116 3402 5789 36882
Lisp 1 684 2242 7515
make 7 498 473 2044
C++ 10 312 277 2000
XML 26 231 0 1972
yacc 2 128 97 1549
YAML 2 2 0 489
DOS Batch 11 85 50 322
HTML 1 19 2 98
-------------------------------------------------------------------------------
SUM: 2510 142085 173903 529677
-------------------------------------------------------------------------------
How to count the number of files in a directory and the total number of lines of code in Linux using the command The command to know the total number of files with a specified suffix name: find . -name "*.cpp" | wc -l Know the total number of lines of code in a directory and the number of lines in a single file: find . -name "*.h" | xargs wc -l
Just pass the file name to the wc command
I once used a tool under Windows, the detailed introduction is here
http://code.google.com/p/boomworks/wiki/SourceCounterCN
It can count data including: number of lines of code, comments, blank lines, file size, etc.
In addition, it also supports the analysis and prediction of manpower, costs, quality indicators, etc. at each development stage of the software development project.
Some are also introduced on the cloc website
cloc Basic Use
I used to use find wc, now I use cloc.
cloc is a code statistics tool written in perl. Not only supports multiple languages, but also counts blank lines and comment lines.
You can also use the exec parameter of find, and then add it up with awk.
http://igaojie.com/?p=308
Using shell is the easiest. . . It can also be like this. cat
find . -name *.c
| wc -lfind . -name "*.[ch]*" | xargs wc -l | grep "total" | awk '{ print $1}'
http://blog.csdn.net/tianmohu...
How to count the number of files in a directory and the total number of lines of code in Linux using the command
The command to know the total number of files with a specified suffix name:
find . -name "*.cpp" | wc -l
Know the total number of lines of code in a directory and the number of lines in a single file:
find . -name "*.h" | xargs wc -l
find . -name "*.c" | xargs grep '^.' | wc -l //Exclude blank lines
wc -l
find . -name "*.c "
//Note that the find content is wrapped by the symbol below ~Linux counts the number of files in the folder
The first method:
ls -l|grep “^-”|wc -l
ls -l