Number of files and lines of code in the Linux statistics directory

Source: Internet
Author: User

1. Statistics The current directory, the number of PHP files

Find " *.php " WC -L

2. Count all php file code lines in the current directory

Find " *.php " Xargs  WC -L

Or

WC -l 'find'*.php"tail -n1

Command description

WC -l 'find'*.php"'

Output results

Number of Rows | File

1./test.php
/phpinfo.php.
46 Total Dosage

Tail -n1

Output the last 1 lines, if the last 2 lines of output can be 1 after n to change to 2

Output results

46 Total Dosage

3. Statistics the current directory of all the PHP file code lines, filtered blank lines

Find " *.php " Xargs  grepWC -L

Command description

Grep-v Selecting rows that do not match

4. Get the number of rows per file in the current directory

 for  in 'lsdoesWCdone;

Number of files and lines of code in the Linux statistics directory

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.