Count Lines With cloc
Break down a codebase into code, comment and blank lines per language.
Run cloc in a project directory for a per-language count table.
01Command
Command
$ cloc .02What it does
cloc recursively detects languages, ignores version-control and binary files, and reports files, blank, comment and code line counts, with a diff mode between two trees. It is a lightweight way to size a project or check a contribution.
03Risk
!Warning: Counts depend on file extension detection; unusual extensions may be classified as 'other' or skipped.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- cloc repositoryEvidence: Debian packages cloc, which counts lines of code and comments for many languages.
- Debian package: clocEvidence: Debian packages cloc, which counts lines of code and comments for many languages.
Last verified: 2026-09-22 · Category: Developer