To count lines of code using the command line

Source: Internet
Author: User

As a project manager, it is important to understand the overall situation of the project, previously through the IntelliJ statitic plug-in statistical code situation, but now the Android Studio2 can not be used, so had to be counted by other methods. You can find the regular expression directly through the Find function \ n and the following command line simple statistics, but the statistical dimension does not have plug-in so detailed, everyone who has better statistical tools can comment ah



Open the terminal and use the CD command to navigate to the directory where the project resides, and then call the following name to count the number of lines and totals for each source code file:

Find. "("-name "*.m"-or-name "*.mm"-or-name "*.cpp"-or-name "*.h"-or-name "*.rss" ")"-print | Xargs wc-l


where-name "*.M" represents a file with an. m extension. The commands to count both Java files and XML files are:

Find. -name "*.java"-print | Xargs wc-l

Find. -name "*.xml"-print | Xargs wc-l


To count lines of code using the command line

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.