Count Lines With cloc

Break down a codebase into code, comment and blank lines per language.

LinuxtextstatscliLow risk
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

RiskLow risk
Requirementssudo apt install cloc
!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 repository
    Official project · vendor-doc · 2026-09-20
    Evidence: Debian packages cloc, which counts lines of code and comments for many languages.
  • Debian package: cloc
    Debian · vendor-doc · 2026-09-20
    Evidence: Debian packages cloc, which counts lines of code and comments for many languages.

Last verified: 2026-09-22 · Category: Developer

06Related solutions