wc is a cool little tool to print newline, word, and byte counts for a file.
To print the number of lines in a file, run the following
$ cat <file> | wc -l
The -l option prints the number of newlines from the input pipe.
Other possible options are
-c, --bytes
print the byte counts
-m, --chars
print the character counts
-l, --lines
print the newline counts
-L, --max-line-length
print the maximum display width
-w, --words
print the word counts