Tokei
Command-line program that counts files, lines, code, comments and blanks in source code, grouped by language.
Tested on Linux
Use it
Linux x86_64
Download v12.1.2 x86_64-unknown-linux-musl release tarball and extract tokei into ~/.local/bin
mkdir -p ~/.local/bin /tmp/tk && curl -fsSL -o /tmp/tk/tokei.tar.gz https://github.com/XAMPPRocky/tokei/releases/download/v12.1.2/tokei-x86_64-unknown-linux-musl.tar.gz && tar -xzf /tmp/tk/tokei.tar.gz -C ~/.local/bin
Where the README and reality differ
- README: You can download prebuilt binaries in the releases section
What worked: Releases v13.0.0 onward (latest v15.0.0) have no binary assets; the newest prebuilt Linux binary is v12.1.2, so the binary path gives an older version than cargo would
Check that it works
tokei --versionThe output should contain “tokei 12.1.2 compiled with serialization support: json, cbor, yaml”.
First thing to try
mkdir -p foo && cat > foo/main.rs <<'EOF'
// line comment
/* outer /* nested */ still comment */
fn main() {
let s = "/* not a comment */";
println!("{}", s); // trailing
}
EOF
cat > foo/app.py <<'EOF'
# comment
def f():
return 1
EOFtokei ./fooRun tokei <directory> to see a table of files, lines, code, comments and blanks for each language in that folder.
What it does
- Count code, comments and blanks by languageTested
How to use it
- Run
tokei <directory>on your project folder. - Read the table: one row per language with files, lines, code, comments and blanks.
- Run
- Export statistics as CBOR, JSON or YAMLTested
How to use it
- Run
tokei <directory> --output jsonto get the statistics as JSON. - Run
tokei <directory> --output yamlto get the statistics as YAML, including per-file entries.
- Run
- Count nested and multi-line comments correctlyNot shown working
- Use Tokei as a library in your own projectsNot tested
How far pickfit got
Linux x86_64
- Installs
- Starts
- 2 of 4 features work
- Works offline
macOS and Windows: the project says it runs there; pickfit hasn’t tried it.
Good for
- count lines of code per language in a project directory
- export code statistics as JSON for other programs
- show per-file code statistics
An alternative to cloc.
How pickfit tested it
Each run starts from a clean machine and follows the steps above. How pickfit verifies
Linux x86_64
Its main function works
- Replayed from scratch
- Works offline
- Checked on 15 Nov 2026
- Version tokei 12.1.2 compiled with serialization support: json, cbor
Differences the test machine hit
- README: Install via cargo install tokei, or a distro package manager (apk/pacman/dnf)
In the test: No Rust toolchain or root here; used the prebuilt release binary (README 'Manual > Downloading')