Number of statistics code lines under Linux

Source: Internet
Author: User

When we are programming, we often want to count how many lines of code we have written, what should we do?    Although there are lines of code in the editor such as VIM, you can't open them and add them up?    this time need to use WC this tool, hehe, don't look at the name is not how, the function is very powerful OH.   Usage:     current directory:  wc-l *.c *.h   current directory and subdirectories:  find. -name *.c |xargs Wc-l find. -name *.cpp | Xargs Wc-l find. -name *.h |xargs wc-l   statistics file lines (single file):   wc-l file   For example:  [email  protected]:~/workspace/android/game$ wc-l lgameandroid2dactivity.java 906 LGameAndroid2DActivity.java    Statistics Directory of all file lines (all directories):   find. -name *.java | Xargs wc-l   For example:   [email protected]:~/workspace/android$ find. -name *.java | Xargs wc-l     817 ./game/core/lhandler.java     ./game/core/lflicker.java      ...     515 ./game/utils/collection/arraymap.java     162./game/utils/ collisionutils.java     178 ./game/utils/numberutils.java   68753 total   Statistics Catalog and sort by number of rows (sorted by row size):   find. -name *.java | Xargs Wc-l | sort-n  [email protected]:~/workspace/android$ find. -name *.java | Xargs Wc-l | sort-n      25 ./game/action/sprite/collidable.java      26./game/core/ graphics/component/collisionquery.java      27./game/core/graphics/filter/imagefilter.java       28 ./game/lmode.java      ...    1467./game/core/geom/ path2d.java    1919 ./game/core/graphics/screen.java    2417./game/core/graphics/ device/lgraphics.java    3050 ./game/core/geom/affinetransform.java   68753 total  Statistics catalog and sort by number of rows (sort by row file name):   find. -name *.java | Xargs Wc-l | sort-k2  [email protected]:~/workspace/android$ find. -name *.java | Xargs Wc-l | sort-k2     ./game/action/actioncontrol.java    /game/action/actionevent.java      34 ./game/action/actionlistener.java     &nbsp, .....      178 ./game/utils/numberutils.java     342./game/utils/recordstoreutils.java       58 ./game/utils/screenutils.java     650./game/utils/stringutils.java    68753 Total

Number of statistics code lines under Linux

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.