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  , ..... 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