commands

wc — count newlines, words, bytes or characters

-l counts newline bytes, -w words, -c bytes, -m characters in the active locale. With stdin, no filename is appended to the count. Example assumes a fresh text-streams lab fixture.

Formal Syntax & Structure

linux syntaxlinux
wc [OPTION]... [FILE]...

Parameters & Attributes

NameTypeDescription
-loptionNewlines
-woptionWords
-coptionBytes
-moptionCharacters
FILEoperandInput file

Return Value

exit status and output

GNU wc prints requested counts and returns nonzero on read/write errors. A zero count is valid output, not failure; line counts count newline bytes.

Working Example

Example Snippetlinux
wc -l < events.txt
Linux Reference