Forrest logo
tool overview
On this page you find all important commands for the CLI tool cloc. If the command you are looking for is missing please ask our AI.

cloc

cloc stands for "Count Lines of Code," and it is a command-line tool used to analyze the source code in various programming languages. It provides information about the number of lines, files, and code size in a software project.

Here are some key features of cloc:

  1. Language Detection: cloc can automatically detect and analyze files in over 200 programming languages.

  2. Code Counting: It accurately counts the lines of code, including comments and blank lines, in each file and provides a summary of the total lines for each language.

  3. Output Formats: The tool can generate output in various formats, including plain text, CSV, XML, JSON, SQLite, and more, making it suitable for integration with other tools or further analysis.

  4. Advanced Metrics: It offers additional metrics like the number of non-blank lines, blank lines, comment lines, code-to-comment ratio, and more.

  5. Directory Analysis: cloc can analyze entire directories or specific files, making it useful for measuring code size and understanding the structure of a software project.

  6. Customizable Options: The tool provides options to exclude specific files or directories, filter files by extension, and enable/disable counting of certain types of lines.

cloc is a valuable tool for software developers, project managers, and researchers who want to understand the complexity and size of their codebase or compare different projects written in various programming languages. It can help in estimating development efforts, assessing code quality, and tracking changes over time.

List of commands for cloc:

  • cloc:tldr:066e2 cloc: Count all the lines of code in a directory, displaying the results for each file instead of each language.
    $ cloc --by-file ${path-to-directory}
    try on your machine
    explain this command
  • cloc:tldr:2694f cloc: Count all the lines of code in a directory.
    $ cloc ${path-to-directory}
    try on your machine
    explain this command
  • cloc:tldr:55e30 cloc: Ignore files that are ignored by VCS, such as files specified in `.gitignore`.
    $ cloc --vcs git ${path-to-directory}
    try on your machine
    explain this command
  • cloc:tldr:ad141 cloc: Compare 2 directory structures and count the differences between them.
    $ cloc --diff ${path-to-directory-one} ${path-to-directory-two}
    try on your machine
    explain this command
  • cloc:tldr:d7ec3 cloc: Count all the lines of code in a directory, displaying a progress bar during the counting process.
    $ cloc --progress=1 ${path-to-directory}
    try on your machine
    explain this command
tool overview