Here we are going to learn about to count all the lines of code in a specific directory and its subdirectories.

find and wc -l commands return the number of line of codes in the directory.

The below code returns the count of all the lines in a specifc directory without subdirectories.

find . -name '*.php' | wc -l


If we  want to know the count of all the lines of code in a directory recursively use the code as below

find . -name '*.php' | xargs wc -l


When the file names with special characters use the below code:

find . -name '*.php' | sed 's/.*/"&"/' | xargs  wc -l