wc — Word Count
wc counts lines, words, and characters in files.
Basic usage
wc /etc/passwd
Output: 45 88 2512 /etc/passwd
Meaning: 45 lines, 88 words, 2512 bytes
Specific counts
wc -l /etc/passwd # Line count only
wc -w file.txt # Word count only
wc -c file.txt # Character/byte count
wc -m file.txt # Character count (multibyte aware)
Multiple files
wc -l *.txt # Count lines in all .txt files
Combined with pipes
ls /etc | wc -l # How many files in /etc?
cat file.txt | wc -w # Count words via pipe