Command-line tool
loc
brew/loc
Checked 25 Oct 2026, 21:09 UTC · Listing refreshed from Homebrew, winget, npm, Scoop and cargo; npm packages checked against OSV.dev
Count lines of code quickly
At a glance
- Type
- Command-line tool
- Install on
- macOS, Linux
- Last checked
- 25 Oct 2026, 21:09 UTC
Install it
macOS
brew install loc
Linux
brew install loc
Print lines of code in the current directory
loc
Print lines of code in the target directory
loc path/to/directory
Print lines of code with stats for individual files
loc --files
Related command-line tools
- tokei
Program that allows you to count code, quickly rust linux macos windows cli code cloc sloc statistics tokei… - cloc
Statistics utility to count lines of code programming-language cloc count-lines - sloccount
Count lines of code in many languages - scc
Fast and accurate code counter with complexity and COCOMO estimates cli code golang cloc complexity sloc sloccount… - sloc
Simple tool to count source lines of code developer-tools cli csharp cloc static-analysis sloc dotnet-tool… - jrnl
Command-line note taker - jprq
Join Public Router, Quickly - ignoreit
Quickly load .gitignore templates
Listing text is written by the maker; AptLynx lists tools and does not vouch for them. Find another tool · Browse by topic · For agents