Indiana University
University Information Technology Services
What are archived documents?

Login is for authorized groups (e.g., UITS, OVPIT, and TCC) that need access to specialized Knowledge Base documents. Otherwise, simply use the Knowledge Base without logging in.


In Unix, how do I get the line, word, or character count of a document?

In Unix, to get the line, word, or character count of a document, use the wc command. At the Unix shell prompt, enter: wc filename Replace filename with the file or files for which you want information. For each file, wc will output three numbers. The first is the line count, the second is the word count, and the third is the character count. For example, if you entered wc .login, the output would be something similar to the following: 38 135 847 .login To narrow the focus of your query, use one or more of the following wc options:

Option Entities counted
 -c  bytes
 -l  lines
 -m  characters
 -w  words

Note: In some versions of wc, the  -m  option will not be available or  -c  will report characters. However, in most cases, the values for  -c  and  -m  are equal.

For example, to find out how many bytes are in the .login file, you could enter: wc -c .login

You may also pipe standard output into wc to determine the size of a stream. For example, to find out how many files are in a directory, enter: /bin/ls -l | wc -l

For more information about wc, read its man page. To do this, at the Unix prompt, enter: man wc

At Indiana University, for personal or departmental Linux or Unix systems support, see At IU, how do I get support for Linux or Unix?

This is document adpb in domain all.
Last modified on September 16, 2010.

I need help with a computing problem

  • Fill out this form to submit your issue to the UITS Support Center.
  • Please note that you must be affiliated with Indiana University to receive support.
  • All fields are required.

Please provide your IU email address. If you currently have a problem receiving email at your IU account, enter an alternate email address.

I have a comment for the Knowledge Base

  • Fill out this form to submit your comment to the IU Knowledge Base.
  • If you are affiliated with Indiana University and need help with a computing problem, please use the I need help with a computing problem section above, or contact your campus Support Center.