wc

Count lines, words, and bytes in files.

What it does

wc (word count) reports the number of lines, words, and bytes in input. It is commonly used for quick statistics and validation.

Quick Start

# Count lines, words, bytes
wc file.txt

# Count only lines
wc -l file.txt

Examples

# Count words
wc -w file.txt

# Count characters
wc -m file.txt

# Count multiple files
wc file1.txt file2.txt

# Use in pipeline
cat file.txt | wc -l

Notes