WepsTech
The world of development
Let’s have look on the new thing today. How to count the number of lines in existed project or in a particular file. The question occurs in my mind when my Bose asked me that how many lines you have coded in your project. Then I start searching on that and I found the very simple solution for this problem. And if you know the extension of your files which exists into the project then it’s very easy and simple like cream! So let’s start with the following procedure.
Open your terminal
now reach your project folder location with cd
command in your terminal for Mac
and Command Prompt for Window
system. Now write the following line as per your requirement.
This is for PHP
find . -name '*.php' | xargs wc -l
This is for Javascript
find . -name '*.js' | xargs wc -l
This is for CSS
find . -name '*.css' | xargs wc -l
This is for HTML
find . -name '*.html' | xargs wc -l
This is for JAVA
find . -name '*.java' | xargs wc -l
This is for CLASS
find . -name '*.class' | xargs wc -l
This is for XML
find . -name '*.xml' | xargs wc -l
This is for C
find . -name '*.c' | xargs wc -l
Hopefully you have notice that, with this simple command you can easily find the number lines in your project with the particular extension. You can try with more extensions.
Good Luck 🙂 Happy Coding