Count lines in a file

wc (short for word count) is a command in Linux that displays a count of lines (newline characters, to be precise), words, and bytes for each file you specify. The program prints these three numbers for each file you specify. For example, to find out how many lines, words and bytes bobs_file.txt has, we can use the following command:

linux wc command

In the picture above you can see that the bobs_file.txt file contains 5 lines, 30 words, and its size is 141 bytes.

You can specify more than one file:

linux wc command more files

Use the -l option to print only the line count, -w to print only the word count, and -c to print only the bytes count.
Geek University 2022