wc
[options
] [files
]
Print a character, word, and line count for
files
. If no
files
are given, read standard input. See other examples under
ls
and
sort
.
Print character count only.
Print line count only.
Print word count only.
Count the number of users logged in:
who | wc -l
Count the words in three essay files:
wc -w essay.[123]
Count lines in variable $file (don't display filename):
wc -l <$file