1. Home
  2. Computing & Technology
  3. Linux
photo of Juergen Haas
Juergen's Linux Blog

By Juergen Haas, About.com Guide to Linux since 2003

Count Words With The wc Command

Wednesday December 17, 2008
When you are writing a paper for publication there is often a limit or a requirement on the number of words or the number of characters. The wc command is a quick and easy way to get those kinds of stats on a file, or a set of files. It gives you the number of lines, the number of words, and the number of characters.

For example, if you have written a file "report" and type in "wc report" at the command line, it will give you three numbers, the first one being the number of lines in the file "report", the second one the number words, and the last one the number of characters. The nice thing about the wc command is that it is actually easy to remember: wc stands for "word count".

Comments
February 26, 2009 at 2:38 am
(1) rid says:

hi, I hv little knowledge on scripting. But I would like to know if I want to write a script that when execute it will show number of time the word occur in a file. eg. a word “BOOKS”. What should the script look like?

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Explore Linux
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Linux

©2009 About.com, a part of The New York Times Company.

All rights reserved.