LinuxCommandLibrary

sloccount

TLDR

Count lines in directory

$ sloccount [src/]
copy
Count with details
$ sloccount --details [src/]
copy
Duplicate file handling
$ sloccount --duplicates [src/]
copy
Wide output format
$ sloccount --wide [src/]
copy
Add effort estimates
$ sloccount --effort [1.0] [2.5] [src/]
copy

SYNOPSIS

sloccount [options] directories...

DESCRIPTION

sloccount counts physical source lines of code (SLOC) in software projects. It recognizes many programming languages and provides effort and cost estimates using the COCOMO model.
The tool helps measure project size, estimate development effort, and track codebase growth.

PARAMETERS

--details

Show per-file details.
--duplicates
Count duplicate files.
--crossdups
Count cross-directory duplicates.
--wide
Wide output format.
--effort a b
COCOMO effort parameters.
--schedule a b
COCOMO schedule parameters.
--personcost cost
Annual person cost.
--overhead rate
Overhead rate.
--datadir dir
Data directory.
--addlang lang
Add language.

CAVEATS

COCOMO estimates are rough approximations. Language detection may miss some. Large projects slow to analyze. Generated code may skew counts.

HISTORY

SLOCCount was created by David A. Wheeler to accurately count source lines. It applies software economics models to estimate development effort, helping with project planning and comparisons.

SEE ALSO

cloc(1), tokei(1), wc(1), find(1)

Copied to clipboard