count lines of code

How many lines of code a project has, in total and by language.

  • development
  • text

Steps

  1. cloc .

    lines of code, comments and blanks, by language (cloc)

  2. tokei

    the same, faster (tokei)

  3. git ls-files | xargs wc -l | tail -1

    the lines of every file git tracks

  4. find . -name '*.py' -print0 | xargs -0 wc -l | tail -1

    the lines of every .py file

Commands used

  • cloc
  • tokei
  • wc
  • git

Each has a page in lore: lore cloc opens it.