LinuxCommandLibrary

loc

TLDR

Count lines in current directory

$ loc
copy
Count in specific directory
$ loc [src/]
copy
Exclude directories
$ loc --exclude [test/,vendor/]
copy
Show detailed stats
$ loc -d
copy
Count specific languages
$ loc --include [rs,go]
copy
Output as JSON
$ loc --output-type json
copy

SYNOPSIS

loc [options] [paths]

DESCRIPTION

loc counts lines of code quickly. It identifies languages and separates code, comments, and blanks.
The tool is written in Rust for speed. It supports many programming languages.
loc counts lines of code.

PARAMETERS

PATHS

Directories or files to analyze.
--exclude DIRS
Directories to exclude.
--include LANGS
Languages to include.
-d
Show detailed breakdown.
--output-type FORMAT
Output format (text, json).
--help
Display help information.

CAVEATS

Results may differ from other counters. Language detection heuristic. Rust-based tool.

HISTORY

loc was created as a fast Rust-based alternative to cloc and other lines-of-code counting tools.

SEE ALSO

cloc(1), tokei(1), sloccount(1)

Copied to clipboard