Tokei: Count Your Code, Fast
Ever needed to quickly check how many lines of code are in your project? Maybe you're curious about language distribution, or you just want to brag about your productivity (or lack thereof). Enter Tokei—a blazing-fast, no-nonsense tool for counting code.
What It Does
Tokei (Japanese for "clock") is a command-line utility that scans your codebase and spits out detailed statistics: lines of code, comments, and blanks, broken down by language. It supports over 150 programming languages, from Rust to Markdown to COBOL (yes, really).
Why It’s Cool
- Speed: Tokei is optimized to be fast. It parallelizes file analysis, so even large repos get counted in seconds.
- Accuracy: It respects
.gitignoreand has a.tokeignorefor custom exclusions. - Flexible Output: Want JSON, YAML, or a clean terminal table? Tokei’s got you covered.
- Low Overhead: Written in Rust, it’s a single binary—no runtime dependencies.
How to Try It
Install it via your favorite package manager:
# Homebrew (macOS/Linux)
brew install tokei
# Cargo (Rustaceans)
cargo install tokei
# Chocolatey (Windows)
choco install tokei
Then run it in your project:
tokei
Boom—instant stats. For more options (like excluding directories or custom formats), check the GitHub repo.
Final Thoughts
Tokei is one of those tools that does exactly what it promises, with zero fuss. Whether you’re auditing a legacy codebase, tracking progress, or just satisfying curiosity, it’s a must-have for your CLI toolkit.
Got a favorite code-counting trick? Let us know @githubprojects.