Fast lines of code count command.

By Christopher Talke Buscaino at

Here is a really quick command I've been using to count the lines of code in my current project.

git ls-files | grep -Ev '<dirs_files_to_ignore>' | xargs wc -l | grep total | sed 's/[^0-9]*//g' | awk '{ print "\n" $1 " lines of code in this project"}'

Please note that <dirs_files_to_ignore> needs to have pipe seperated values for any directories or files you want to ignore from the count, for example:

git ls-files | grep -Ev 'node_modules|dist|.png|.jpg.|.jpeg|package.json|package-lock.json' | xargs wc -l | grep total | sed 's/[^0-9]*//g' | awk '{ print "\n" $1 " lines of code in this project"}'

Hope this helps!