wc
Count lines, words and bytes
What it does
wc (word count) prints three numbers: lines, words and bytes. -l keeps just the lines, -w the words, -c the bytes.
wc -l is the one you need most: how many rows in a CSV, lines in a log or files in a list. It fits at the end of a pipe: ls | wc -l counts the files in a folder.
Syntax
wc <file>
wc -l <file>Examples
Count the lines in users.csv
wc -l users.csvsame as:
wc --lines users.csvwc— word count — a counter-l— lines onlyusers.csv— file