Developer's Daily Unix by Example
  main | java | perl | unix | DevDirectory
   
Main
Unix
Education
Unix by Example
   

 

Command wc
Description The "wc" command stands for "word count". It counts the number of characters, words, and lines that are contained in a text stream.
Examples wc /etc/passwd

This command tells you the number of characters, words, and lines in the /etc/passwd file.

wc -l /etc/passwd

This command tells you the number of lines (only) in the /etc/passwd file.

wc -w MyStory

This command counts the number of words in the file named MyStory (which can be useful if you're paid by the word!).

who | wc -l

This command counts the number of users logged into your computer system. The output of the who command is piped into the wc command, which counts the number of lines in the who output.

ps -e | wc -l

This command counts the number of processes running on your computer system.

 


What's related

copyright 1998-2007, devdaily.com, all rights reserved.
devdaily.com, an alvin j. alexander production.