← 返回命令列表

Linux command

scc 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Count lines in current directory

scc

Count specific directory

scc [path/to/dir]

Count specific language

scc --include-ext [py]

Exclude directories

scc --exclude-dir [vendor,node_modules]

Sort by lines

scc --sort lines

Output as JSON

scc --format json

Show complexity estimates

scc -w

Show by file

scc --by-file

说明

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.

参数

--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.

FAQ

What is the scc command used for?

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.

How do I run a basic scc example?

Run `scc` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --include-ext _EXT_ do in scc?

Include only extensions.