This is a website by Willem van Zyl

I'm a project manager, software developer, Apple evangelist and geek from South Africa. I'm passionate about web and mobile application development, usability, productivity, physics, astronomy, science fiction and fantasy.

If you would like to contact me, message me on Twitter or send me an email.

How to count files & lines of code on the command line

09 Sep 2010

At times it’s useful to know how many lines of code your software projects consist of, even if just for bragging rights about the scale of the work you’re doing.

To count the files and lines of code (text) in a directory from the command line, open a new Terminal window, switch to the directory that contains your source code, and enter the following command:

echo 'files: '; find . -type f | wc -l; echo 'lines: ';
  grep -R '.' * | wc -l

After the command runs for a few seconds, you’ll see output similar to the following:

files: 
     301
lines: 
   37217
Do you like this? Share it:

Copyright © Geekology 2011. All Rights Reserved.

Hosted by Code. Like. Clockwork.