Counts blank lines, comment lines, and source code lines across many programming languages
cloc is a command-line tool that counts blank lines, comment lines, and physical lines of source code across many programming languages. It can analyze individual files, directories, compressed archives, and git repositories to provide detailed breakdowns by language. The tool recognizes over 200 programming languages and can process various input formats including ZIP archives and git commits.
The tool is written entirely in Perl with no external dependencies beyond standard Perl v5.6, making it highly portable across Unix-like systems, macOS, and Windows. cloc can compute differences between two versions of a codebase, showing changes in blank, comment, and source lines. It supports advanced features like custom language definitions, SQL output formats, and integration with version control systems.
Developers, project managers, and organizations use cloc for code analysis, project estimation, and tracking codebase growth over time. The tool provides both tabular output for human reading and structured formats for programmatic use, with options for custom column output and report combination.
# via Homebrew
brew install cloc
# via Package Manager
apt install cloc
# via Direct Download
wget https://github.com/AlDanial/cloc/releases/latest/download/cloc-2.08.pl