AlDanial / cloc
git clone https://github.com/AlDanial/cloc.git
v2.10 · 3mo ago
🔥 on GitHub Trending today
cloc counts blank lines, comment lines, and physical lines of source code in many programming languages.
+0
stars, 24h · #15,236
+~0
stars, 7 days · #15,813
+~0
stars, 30 days · #22,276
24k
★ total
1.1k
forks · 28 open issues
Star history (as recorded here)
LanguagePerl
LicenseGPL-2.0
Created2015-09-07 (11y ago)
Last push1d ago
Watchers213
OwnerUser
Seen on GitHub Trending
- 2026-10-22 — #1 daily in perl · +3 ★
- 2026-10-21 — #4 daily in perl · +4 ★
- 2026-10-20 — #4 daily in perl · +2 ★
GitHub topics
Links
- GitHub: github.com/AlDanial/cloc
- Releases · Issues · Hacker News mentions
README excerpt
# 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** [code] **a directory** [code] **an archive** We'll pull cloc's source zip file from GitHub, then count the contents: [code] **a git repository, using a specific commit** This example uses code from PuDB , a fantastic Python debugger. [code] **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): [code] **each subdirectory of a particular directory (Windows/cmd.exe)** [code] # Overview cloc counts blank lines, comment lines, and physical lines of source code in many programming languages. Given two versions of a code base, cloc can compute differences in blank, comment, and source lines. It is written entirely in Perl with no dependencies outside the standard distribution of Perl v5.6 and higher (code from some external modules is embedded within cloc) and so is quite portable. cloc is known to run on many flavors of Linux, FreeBSD, NetBSD, OpenBSD, macOS, AIX, HP-UX, Solaris, IRIX, z/OS, and Windows. (To run the Perl source version of cloc on Windows one needs ActiveState Perl 5.6.1 or higher, Strawberry Perl, Windows Subsystem for Linux, Cygwin, MobaXTerm with the Perl plug-in installed, or a mingw environment and terminal such as provided by Git for Windows. Alternatively one can use the Windows binary of cloc generated with PAR::Packer to run on Windows computers that have neither Perl nor Cygwin.) In addition to counting code in individual text files, directories, and git repositories, cloc can also count code in archive files such as ``.tar`` (including compressed versions), ``.zip``, Python wheel ``.whl``, Jupyter notebook ``.ipynb``, source RPMs ``.rpm`` or ``.src`` (requires ``rpm2cpio``), and Debian ``.deb`` files (requires ``dpkg-deb``). cloc contains code from David Wheeler