tokei

CLI

Count lines of code across projects, by language.

Count lines of code by language with statistics

3 curated recipes · not yet executed by the harness#sloc#count#statistics#code

Recipes

Curated from documentation and usage. Percentages are estimates, not measurements.

Count lines of code in current directory

~99% est.
tokei .

Count excluding specific paths

~97% est.
tokei . --exclude node_modules --exclude dist
Common failures (1)
  • --exclude appears to have no effecttokei takes one glob per --exclude; repeat the flag instead of passing a comma-separated list

Output as JSON

~99% est.
tokei . -o json

Install

Homebrewbrew install tokei
Cargocargo install tokei

Agent notes

When to use
Analyzing codebase size and language composition
Quick examples
  • tokei
  • tokei src/ --exclude '*.json'

Use from an agent

curl -s https://clihub.com/api/tools/tokei | jq '.agentHints.provenRecipes[] | {task, command, verified}'

Or call get_tool with slug tokei on the MCP server at https://clihub.com/mcp.

Homepage ↗MIT OR Apache-2.00 views