Viewing Content

wc

Counts lines, words, bytes, or characters.

wc summarizes text size and is often used in pipelines for quick counts.

Syntax
wc [options] [file...]

Arguments explained

  • -l counts lines.
  • -w counts words.
  • -c counts bytes.
  • -m counts characters.

Common examples

Count lines
wc -l access.log

Shows how many lines are in the log.

Count matching lines
grep -i error app.log | wc -l

Counts error lines from grep output.

wc Command
FieldDetails
Commandwc
CategoryViewing Content
Primary useCounts lines, words, bytes, or characters.
Syntaxwc [options] [file...]