wc -l

Count the number of lines in a file

wc -l (word count, lines) counts lines. Pipe any command into wc -l to count its output: grep -r ERROR /var/log/ | wc -l counts all error lines.

Example

$ wc -l /var/log/syslog
48291 /var/log/syslog
Tip: Type it yourself in the terminal below - reading is not the same as doing.