June 2004
Intermediate to advanced
1056 pages
39h 58m
English
wc
wc [options] [files]
Prints byte, character, word, and line counts for each file. Prints a
total line for multiple files. If no
files are given, reads standard input. See
other examples
under ls and sort.
-c
Print byte count only.
-l
Print line count only.
-m
Print character count only.
-w
Print word count only.
Count the number of users logged in:
$ who | wc -lCount the words in three essay files:
$ wc -w essay.[123]Count lines in the file named by variable $file
(don’t display the filename):
$ wc -l < $fileRead now
Unlock full access