utility

wc

Count newlines, bytes, characters or words respectively. Locale affects character and word interpretation.

Formal Syntax & Structure

bash syntaxbash
wc [-l|-c|-m|-w] [FILE ...]

Parameters & Attributes

NameTypeDescription
FILEpathInput file or stdin.
-loptionCount newline bytes.

Return Value

exit status

Exit status 0 on success; nonzero indicates failure or a command-specific condition. See description and example.

Working Example

Example Snippetbash
printf 'a\nb' > records.txtwc -l < records.txtwc -c < records.txt
Bash Reference