Number of Linux statistics files or lines of code

Source: Internet
Author: User
Statistics The total number of files for the specified suffix command: find. -name *.cpp | Wc-l statistics The total number of lines of code in a directory and the number of individual file rows: Find. -name *.h | Xargs wc-llinux number of files in the statistics folder The first method: Ls-l|grep "^-" |wc-lls-l long list output The file information in this directory (note that the file here, different from the general file, may be directory, links, device files, etc.). If the Ls-lr|grep "^-" |wc-l can be counted together with the files in the subdirectory. grep ^-here will be a long list of output information filtering part, only keep the general file, if only the directory is ^DWC-L statistics output information of the number of rows, because it has been filtered to only the general file, so the statistical result is the general file information line number, and because a line of information corresponding to a file, So that is the number of files. The second method: Find./-type f|wc-l because the default find will go to the subdirectory lookup, if you only want to find the file of the current directory with the need to explain that the second method is much faster than the first method, especially when it is also statistical subdirectories.

Number of Linux statistics files or lines of code

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.