Linux: Codezeilen nach Programmiersprache mit cloc zählen

Linux: Codezeilen nach Programmiersprache mit cloc zählen

cloc ist ein sehr hilfreiches Werkzeug zum zählen der Codezeilen je nach Programmiersprache. Das Tool ist einfach auszuführen und gibt danach eine Auflistung in Form einer Tabelle zurück. Wie eine Ausgabe aussieht, könnt ihr am Bild oben sehen.

Installation
[sourcecode language=”bash”]
apt-get install cloc
[/sourcecode]

Ausführen
[sourcecode language=”bash”]
cloc /var/www/*
[/sourcecode]

Oder wenn man es direkt nutzen möchte und keine Installation vornehmen kann man es auch hier downloaden.

[sourcecode language=”bash”]
huskynarr@huskynarr:/$ perl cloc-1.60.pl /var/www/domain.tld/
585 text files.
376 unique files.
1315 files ignored.

http://cloc.sourceforge.net v 1.60 T=12.08 s (29.1 files/s, 7166.5 lines/s)
——————————————————————————-
Language files blank comment code
——————————————————————————-
PHP 310 9537 3530 62271
Javascript 11 811 697 3193
XML 1 1 1 2508
CSS 20 272 121 2018
HTML 9 252 40 1297
Bourne Shell 1 0 3 4
——————————————————————————-
SUM: 352 10873 4392 71291
——————————————————————————-
huskynarr@huskynarr:/$
[/sourcecode]