In Bash, how do I count the number of non-blank lines of code in a project? cat foo.c | sed '/^\s*$/d' | wc -l And if you consider comments blank lines: cat foo.pl | sed '/^\s*#/d;/^\s*$/d' | wc -l Although, that's language dependent. #!/bin/bash find . -path './pma' -prune -o -path './blog' -prune -o -path './punbb' -prune -o -path './js/3rdparty' -prune -o -print | egrep '\.php|\.as|\.sql|\.css|\.js' | grep -v '\.svn' | xargs cat | sed '/^\s*$/d' | wc -l The above will give you the total count of lines of code (blank lines removed) for a project (current folder and all subfolders recursively