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