An excerpt from the repository, fetched Nov 13, 2026.
Read the project’s introduction
cloc
Count Lines of Code
cloc counts blank lines, comment lines, and physical lines of source code in many programming languages.
Latest release: v2.10 (July 4, 2026)
cloc moved to GitHub in September 2015 after being hosted
at http://cloc.sourceforge.net/ since August 2006.
Quick Start
Step 1: Install cloc (see Install from Github Releases
and Install via package manager) or run cloc's
docker image. The Windows executable has no requirements.
The source version of cloc requires a Perl interpreter, and the
Docker version of cloc requires a Docker installation.
Step 2: Open a terminal (cmd.exe on Windows).
Step 3: Invoke cloc to count your source files, directories, archives,
or git commits.
The executable name differs depending on whether you use the
development source version (cloc), source for a
released version (cloc-2.10.pl) or a Windows executable
(cloc-2.10.exe).
On this page, cloc is the generic term
used to refer to any of these.
Include Security has a
YouTube video
showing the steps in action.
a file
prompt> cloc hello.c
1 text file.
1 unique file.
0 files ignored.
https://github.com/AlDanial/cloc v 1.65 T=0.04 s (28.3 files/s, 340.0 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
C 1 0 7 5
-------------------------------------------------------------------------------
a directory
prompt> cloc gcc-5.2.0/gcc/c
16 text files.
15 unique files.
3 files ignored.
https://github.com/AlDanial/cloc v 1.65 T=0.23 s (57.1 files/s, 188914.0 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
C 10 4680 6621 30812
C/C++ Header 3 99 286 496
-------------------------------------------------------------------------------
SUM: 13 4779 6907 31308
-------------------------------------------------------------------------------
an archive
We'll pull cloc's source zip file from GitHub, then count the contents:
prompt> wget https://github.com/AlDanial/cloc/archive/master.zip
prompt> cloc master.zip
https://github.com/AlDanial/cloc v 1.65 T=0.07 s (26.8 files/s, 141370.3 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
Perl 2 725 1103 8713
-------------------------------------------------------------------------------
SUM: 2 725 1103 8713
-------------------------------------------------------------------------------
a git repository, using a specific commit
This example uses code from
PuDB, a fantastic Python debugger.
prompt> git clone https://github.com/inducer/pudb.git
prompt> cd pudb
prompt> cloc 6be804e07a5db
48 text files.
41 unique files.
8 files ignored.
github.com/AlDanial/cloc v 1.99 T=0.04 s (1054.9 files/s, 189646.8 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
Python 28 1519 728 4659
reStructuredText 6 102 20 203
YAML 2 9 2 75
Bourne Shell 3 6 0 17
Text 1 0 0 11
make 1 4 6 10
-------------------------------------------------------------------------------
SUM: 41 1640 756 4975
-------------------------------------------------------------------------------
each subdirectory of a particular directory
Say you have a directory with three different git-managed projects,
Project0, Project1, and Project2. You can use your shell's looping
capability to count the code in each. This example uses bash (scroll down for cmd.exe example):
prompt> for d in ./*/ ; do (cd "$d" && echo "$d" && cloc --vcs git); done
./Project0/
7 text files.
7 unique files.
1 file ignored.
github.com/AlDanial/cloc v 1.71 T=0.02 s (390.2 files/s, 25687.6 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
D 4 61 32 251
Markdown 1 9 0 38
make 1 0 0 4
-------------------------------------------------------------------------------
SUM: 6 70 32 293
-------------------------------------------------------------------------------
./Project1/
7 text files.
7 unique files.
0 files ignored.
github.com/AlDanial/cloc v 1.71 T=0.02 s (293.0 files/s, 52107.1 lines/s)
----------------------------
Read the full README on GitHub