Today, listen to a colleague said that there is a cloc tool can also quickly count the number of lines of source code so, I went to understand the next, of course, this tool is written in Perl open source tools, it must be said that the GNU Open Source Foundation and Epel are a good platform, Of course, the GNU official website can also be downloaded to the Cloc source package, but in order to use the configuration of the system directly in the installation of Yum to install, note that the general configuration of Yum is not downloadable, you must add the Epel configuration in the image to use Yum to install Cloc, Of course, it is recommended to use the system is already in use of the Yum image source, of course, I use the source of Ali, you can go to the source image of Ali download Epel configuration file, yum Repo file address is as follows: http://mirrors.aliyun.com/repo/ Download the repo file for your system in Yum Makecache generate the next meta-data, directly yum-y install Cloc installation can be, Cloc is written in Perl so must be Perl's dependence, And we usually count the number of lines of code in a project under a folder is also very simple
[email protected] scripts]# cloc /usr/local/scripts/ 2 text files. 2 unique files. 0 files ignored.http://cloc.sourceforge.net v 1.58 t=0.5 s (4.0 files/s , 26.0 lines/s)------------------------------------------------------------------------------- language files blank comment Code-------------------------------------------------------------------------------bourne shell 2 3 0 10-------------------------------------------------------------------------------sum: 2 3 0 10----------------------- --------------------------------------------------------
This allows for quick statistics on the number of lines of code, CLOC also supports more than 100 language recognition support
[Email protected] scripts]# Cloc--show-lang|wc-l107
Of course, the real purpose of cloc is not only used to count the number of lines of code and other information, it can also be used in comparison with the file and diff is the same, of course, want to know more ways to see the man cloc get more information
This article from the "Technical essay" blog, reproduced please contact the author!
cloc--Source Code counting tool