Statistics on the number of lines of code in LINUX

Source: Internet
Author: User

In LINUX, we often want to calculate the number of lines of code that we have written during programming. What should we do at this time? Although Vim and other editors have lines of code displayed, they cannot be opened one by one and then added up? The wc tool is required at this time. It is very powerful, though its name is not very good. Usage: www.2cto.com: wc-l * in the current directory *. c *. h current directory and subdirectory: find. -name *. c | xargs wc-l find. -name *. cpp | xargs wc-l find. -name *. h | xargs wc-l number of statistics file lines (single file): www.2cto.com wc-l file for example: homer @ ubuntu :~ /Workspace/android/game $ wc-l LGameAndroid2DActivity. java 906 LGameAndroid2DActivity. the number of lines of all files in the java statistics directory (all directories): find. -name *. java | xargs wc-l example: homer @ ubuntu :~ /Workspace/android $ find. -name *. java | xargs wc-l 817. /game/core/LHandler. java 140. /game/core/LFlicker. java... 515. /game/utils/collection/ArrayMap. java 162. /game/utils/CollisionUtils. java 178. /game/utils/NumberUtils. java 68753 total www.2cto.com: find. -name *. java | xargs wc-l | sort-n homer @ ubuntu :~ /Workspace/android $ find. -name *. java | xargs wc-l | sort-n 25. /game/action/sprite/colpolicable. 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 t The otal www.2cto.com statistics directory is sorted by the number of rows (by row file name): find.-name *. java | xargs wc-l | sort-k2 homer @ ubuntu :~ /Workspace/android $ find. -name *. java | xargs wc-l | sort-k2 210. /game/action/ActionControl. java 116. /game/action/ActionEvent. java 34. /game/action/ActionListener. java .... 178. /game/utils/NumberUtils. java 342. /game/utils/RecordStoreUtils. java 58. /game/utils/ScreenUtils. java 650. /game/utils/StringUtils. java 68753 total
 

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.