While it might seem a little of a mundane task, counting the lines of code in your programming projects can be a useful thing to do, and provides you with interesting statistics.
Cloc is a Perl script written to allow you to do just that. Download the script, and then from a command line, you simply pass it a directory of source code, or a single file if you wish.
$ perl cloc.pl /path/to/code
Cloc is more than just a tool for counting the number of lines in the file, it is more clever than that. Cloc detects the programming language if it can, and then shows you the number of blank lines, code and comments of each file.
With a single file, Cloc might give output similar to this:
As I've mentioned, however, Cloc's real strong point is when you point it at a directory or several directories of source code.
Quite frankly, I think this is a pretty indispensable tool for any programmer interested in getting statistics on their code, especially when you want an overview of the whole project.
Cloc can be downloaded from here. The Perl script version should work on any operating system where you have a working installation of Perl. Windows users can download the pre-built exe as well.