Linux

How to count the number of lines in a file? What about words?

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

For these we can use wc command.

  1. To count the number of lines in file

wc -l

  1. To count the number of words in file

wc -w