Ever wanted to know how many lines of code you have written?

Whilst working on a large site, or even a moderately sized one, there may come a time when you stop and think ‘Just how many lines have I coded?’. Today I’m going to show you a very simple way to find the answer, and also break it down into languages, HTML, PHP, Javascript, etc…

1 First of all you need to download a copy of the Perl script Cloc. You can get it from http://sourceforge.net/projects/cloc/files/ — the latest version is 1.53.

2 Download the script (if you have copied and pasted it from the browser window, make sure you give it the .pl Perl extension).

3 Next, open up Terminal.app and navigate to the script. I put mine in a folder called ‘TerminalScripts’ in my home folder, so…

cd TerminalScripts

…gets me there.

4 Run the cloc script, referencing the folder containing the project you want to analyse eg:

perl cloc-1.53.pl /Users/duncan/Webserver/OxfordTravelGuide-SVN

Cloc 1.53

And that’s it, simple!