🧀 Learn Linux

Commonly used · Reading and processing text

wc: Count lines, words and bytes

Put in free practice

Syntax

wc [-lwc] [file…]

Options

-l
Number of newlines
-w
number of words
-c
UTF-8 Number of bytes

Examples

wc -l logs/app.log

Usage and sandbox support

wc -l counts newlines; the last line will not be counted if it does not have a newline.

Hands-on exercises

Full documentation ↗

Related commands