What It Is
cloc is a practical command-line utility for counting lines in source files. It separates code, comments, and blank lines, then groups the result by programming language.
The project predates its GitHub life: it was hosted on SourceForge from 2006 and moved to GitHub in 2015. That history matches its character: a mature small tool that does one job well.
What Is Inside
The main version is written in Perl, while releases make it easy to run without a complicated build. Windows has a standalone executable, and Linux or macOS users often install it through a package manager.
cloc can process source directories and archives. That is useful when comparing project versions or estimating a codebase before fully unpacking it into a working tree.
How People Use It
Teams run cloc before audits, migrations, technical-debt reviews, or reports. It does not judge code quality, but it gives a quick and repeatable view of size and language mix.
The distribution by language can be more useful than the total. A surprising amount of templates, generated files, or old scripts can reveal where cleanup is needed.
Example
The example points cloc at a project directory and writes a JSON report, which is convenient for later processing.
Counting A Project
The command counts lines by language and stores a machine-readable report.
cloc ./app --json --out cloc-report.json
Strengths And Limits
cloc’s strength is simplicity and repeatability. The same command can be scripted, used in checks, and compared across branches.
The limit is that line count is not complexity. cloc measures size, but it does not evaluate architecture, tests, or readability.
Project Context
cloc is maintained in the AlDanial/cloc repository; its public project history starts on 2015-09-07. GitHub reports the primary language as Perl, and the license as GPL-2.0.
For a catalog page, this context matters because the reader sees a real project with an owner, license, technical base, and public change history rather than an abstract name.