What's an easy way to get a line count or other stats of a file?

Online tools
Microsoft Windows users
MS-DOS and Windows command line users
Linux and Unix users

Online tools

Paste any text into our text tool to get full statistics on the submitted text. Below is just a few of the stats our online tool gives you about your text.

  • First longest word - The first found longest word in your text.
  • First shortest word - The first shortest word in your text.
  • Character count - Total characters in your text.
  • Word count - Total words in your text.
  • Avg word length - The average length of words in your text.
  • Top words - The most common words in your text with no filters.
  • Top non-common words - The most common words with a filter that removes common words like "and" in your text.
  • Sentence count - Total sentences in your text.
  • Longest sentence - The longest sentence in all of your text.
  • Avg. sentence length - The average sentence length in your text.
  • Line count - The total lines in your text.
  • Longest line - The longest line found in your text.
  • Vowels - Total vowel count in your text.
  • Consonants - Total consonants in your text.
  • Spaces - Total spaces in your text.
  • Uppercase characters - Total uppercase characters in your text.
  • Lowercase characters - Total lowercase characters in your text.
  • Non-alpanumeric - The number of non-alphanumeric characters in your text.
  • Total Bytes - Total bytes your text requires.
  • Total Bits - The total number of bits your text requires.

Microsoft Windows users

Microsoft WordMicrosoft Word

Users who have Microsoft Word installed on their computer can view statistics, such as the amount of pages, paragraphs, lines, words, characters, and characters with spaces, by following the steps below.

  1. Open Microsoft Word.
  2. Click File at the top of the Window.
  3. Click Properties.
  4. In the Properties window, click the Statistics tab.

WordPerfect

Users who have Corel WordPerfect installed on their computer can view statistics, such as characters, words, sentences, lines, paragraphs, pages, and other averages of the page by following the steps below.

  1. Open WordPerfect.
  2. Click File at the top of the Window.
  3. Click Properties.
  4. In the Properties window, click the Information tab.

OpenOffice Writer

If you have OpenOffice installed on your computer, it too can display lots of statistics about a file. See the below Linux and Unix users OpenOffice section for steps on doing this.

In addition to the above suggestions, there are thousands of different text editors available on the Internet, many of them capable of displaying the statistics of a file.

MS-DOS and Windows command line users

Below is a listing of different methods of getting statistic information on files while in MS-DOS.

Find command

Using the below find command would list every line that does not contain "&*fake&*", which in every case is not found. Because this command is listing each line that does not contain this string of text you'd get an accurate listing of how many lines of text are in the file.

find /v /c "&*fake&*" programs.txt

Edit

Although very limited, the edit command is capable of displaying the amount of lines in a file. To do this, follow the steps below.

  1. Edit the file you want to view the amount of lines in.
  2. Go to the end of the file. If the file is a large file, you can immediately get to the end of the file by pressing CTRL + END on your keyboard.
  3. Once at the end of the file, the Line: in the status bar displays the line number.

In addition to the above recommendations, there are several third-party MS-DOS utilities designed specifically to count the amount of lines in a file and get other statistics. Click here to open an external search for these utilities.

Linux and Unix users

OpenOffice Writer

Users who have OpenOffice installed on their computer can view statistics, such as the number of pages, tables, graphics, OLE objects, paragraphs, words, characters, and lines, by following the steps below.

  1. Open OpenOffice Writer.
  2. Click File at the top of the Window.
  3. Click Properties.
  4. In the Properties window, click the Statistics tab.

From the command line, users have different ways to count and get statistics about files on their computer. Below are a few examples.

wc command - The wc (word count) command is one of the easiest and fastest methods of getting the amount of characters, lines, and words in a file. See this page for additional information and examples of this command.

pico command - Although limited, running the pico command and displaying your current position can give you line and character information. If you're wanting to see how many lines are in a file, go to the end of the document and press CTRL + C or ^C to get the current position.

vi command and vim command - The vi and vim and its variants are also capable of displaying the line and character counts.

In addition to the above commands, users can write shell scripts, Perl scripts, or any scripts or programs to get any details about the file they want.

Additional information

  • See our line definition for further information and related links on this term.