Current Article:

How to count number of lines in a text file using Linux terminal?

How to count number of lines in a text file using Linux terminal?

Use wc utility:

wc -l <filename>

This will output the number of lines in <filename>:

wc -l file.txt
89592 file.txt

Or, to omit the <filename> from the result use wc -l < <filename>:

wc -l < file.txt
89592