O'Reilly logo

Linux Pocket Guide, 2nd Edition by Daniel J. Barrett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

wc — stdin  stdout  - file  -- opt  --help  --version

Synopsis

wc [options] [files]

The wc (word count) program prints a count of bytes, words, and lines in (presumably) a text file.

$ wc myfile
   24      62     428 myfile

This file has 24 lines, 62 whitespace-delimited words, and 428 bytes.

Useful options

-l

Print the line count only.

-w

Print the word count only.

-c

Print the byte count only.

-L

Locate the longest line in each file and print its length in bytes.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required