wc -w file.txt

Category: File Operations

wc -w file.txt

Count only the number of words in a file

Counts only the number of words in a file. -w means 'words'.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.