I have a folder full of my code, what shell script can I use to find out the total amount of lines of code?

link|improve this question

50% accept rate
feedback

2 Answers

up vote 1 down vote accepted

A very simple solution would be wc -l ./*, which counts the number of lines in all files, as well as each file individually.

If you want something more sophisticated, use sloccount. You can install it e.g. using Homebrew:

sudo brew install sloccount

Run it on the folder containing the code, like this:

sloccount .

It'll give you lines by programming language and directory.

link|improve this answer
If you want per-file counts as well as a total: wc -l ./* – Dennis Williamson Feb 17 '11 at 5:41
@Dennis Thanks, changed my answer. – Daniel Beck Feb 17 '11 at 5:47
feedback

If you just want to count the number of lines in text files, try wc -l *.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.