Name

wc [options] [files] — coreutils

Synopsis

/usr/bin stdin stdout - file -- opt --help --version

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 (character) count only.

-L

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

Get Linux Pocket Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.