top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

what is the command to count the total number of lines, words, and characters contained in a file in linux?

+2 votes
721 views
what is the command to count the total number of lines, words, and characters contained in a file in linux?
posted Mar 18, 2014 by Prachi Agarwal

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

In all the cases you can use the command wc

Find total number of lines: wc -l filename

Find total number of words: wc -w filename

Find total number of characters: wc -m filename

answer Mar 18, 2014 by Salil Agrawal
Similar Questions
+2 votes

Words may be separated by any amount of whitespace characters. There can be integers in a file, but the program should only count words which have at least one alphabetic character.

0 votes

I want to write a c program where I can count no of line, no of blank lines, no of commented lines and no of lines ending with semicolon, please help!!!

...