Linux: Count lines inside a file

At Linux, how to count the number of lines inside the file has? I don't know what is the easiest and best way, but I know one and I use that one always to count lines from file. Here goes the command.
cat fileName.txt | wc -l

At this command, using cat command you can output a file content. And using wc -l command, you can count the line. By combining both of them it will do the trick. First the cat will display the whole file content, and by piping(|) the wc -l command, it will count the number of lines from the cat's output content.

May be someone can provide better ideas/solution to do the task.

Comments

LittleBigBot said…
Well, wc -l fileName.txt would work, and is especially useful for multiple files. using cat just takes out the "fileName.txt" from the output.