LinuxCommandLibrary

scc

TLDR

Count lines in current directory

$ scc
copy
Count specific directory
$ scc [path/to/dir]
copy
Count specific language
$ scc --include-ext [py]
copy
Exclude directories
$ scc --exclude-dir [vendor,node_modules]
copy
Sort by lines
$ scc --sort lines
copy
Output as JSON
$ scc --format json
copy
Show complexity estimates
$ scc -w
copy
Show by file
$ scc --by-file
copy

SYNOPSIS

scc [--include-ext ext] [--exclude-dir dirs] [--format fmt] [options] [paths]

DESCRIPTION

scc (Succinct Code Counter) counts lines of code in many languages. It's extremely fast, using parallelism and optimized parsing.
Output shows files, lines, blanks, comments, and code per language. Wide mode adds complexity estimates based on branching.
Language detection uses file extensions and content inspection. Hundreds of languages are recognized, from common to obscure.
Generated and minified file detection prevents counting boilerplate. Duplicates can be ignored to avoid counting vendored code multiple times.
COCOMO estimation provides rough effort metrics. These are theoretical but useful for comparisons.
Output formats support integration with other tools. JSON and CSV enable processing by scripts and dashboards.

PARAMETERS

--include-ext EXT

Include only extensions.
--exclude-dir DIRS
Exclude directories.
--sort FIELD
Sort by field (files, lines, blanks, code, comments).
--format FMT
Output format (default, json, csv, html, etc.).
-w, --wide
Show complexity and weighted lines.
--by-file
Show per-file breakdown.
--no-duplicates
Ignore duplicate files.
--no-gen
Ignore generated files.
--no-min
Ignore minified files.
--cocomo
Show COCOMO estimates.
-f PATTERN
Match filenames.
-M SIZE
Max file size.

CAVEATS

Complexity estimates are heuristic. Language detection may misidentify some files. Very large codebases may need memory.

HISTORY

scc was created by Ben Boyter around 2018 as a faster alternative to cloc and other line counters. Written in Go, it emphasizes speed through parallelism and efficient algorithms.

SEE ALSO

cloc(1), tokei(1), loc(1), wc(1)

Copied to clipboard