WC command with examples

This is a small post on how to us wc(Word Count) command in Linux and Unix. WC command is a basic command which can give you good statics of the file content such as

  1. Number of characters
  2. Number of words
  3. Number of Lines
In all these options get number of lines of a file/output is frequently used. Lets learn wc command with examples
Example1: How can display or get number of character in my file?
wc -c filename.txt
Example2: I want to count number of words in a file in Linux, how can I do that?
wc -w  filename.txt
Example3: Count number of lines in a given file output
wc -l filename.txt
Example4: How can I get number of files in a given directory
ls | wc -l
To get more help on wc command read man pages
man wc