Count the number of lines of code of your projects

Learn quick command-line methods to count lines of code in your projects using find, cat, and wc commands - get project size statistics by file extension or entire folders.

Count the number of lines of code of your projects
Photo by Patrick Tomasso / Unsplash

After having finished a project, I always like to know its actual size. It does not give any value to my work, but it is always fun to see :)

I found this simple command that will pop out the number of lines of code for a given file extension.


cat `find . -name "*.py"` | wc -l

You can also do it for a whole folder


find . -name "*.py" | xargs wc -l