home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


wc [options ] [files ]

Word count. Print a character, word, and line count for files . If multiple files, print totals as well. If no files are given, read standard input. See other examples under ls and sort .



Print byte count only.


Print character count only. This will be different than -c in a multibyte character environment. Solaris only.


Print line count only.


Same as -C . Solaris 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 file named by $file (don't display filename):

wc -l < $file

Previous: Reference: wait UNIX in a Nutshell: System V Edition Next: Reference: what
Reference: wait Book Index Reference: what

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System