Count Code Lines With tokei

Break a project down by language and count code, comments and blanks.

macOStextstatscliLow risk
Run tokei in a project root to get a per-language line count table.

01Command

Command
$ tokei .

02What it does

tokei recursively scans files, detects the language and reports code, comment and blank line counts, plus totals and a summary table. It is written in Rust and stays fast on large repositories, and can output JSON for scripts.

03Risk

RiskLow risk
CompatibilitymacOS with Homebrew installed
!Warning: Generated or vendored directories inflate counts; exclude them with the ignore file or --exclude.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • Homebrew formula: tokei
    Homebrew · vendor-doc · 2026-09-20
    Evidence: Packages tokei, a fast program that counts code, comments and blanks by language.

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