Linux wc

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

Linux wc

The 'wc' command helps in counting the lines, words and characters in a file.


  1. wc <fileName>     (Counts words, lines and characters)  
  2. wc -l <fileName>      (Counts only lines)  
  3. wc -w <fileName>      (Counts only words)  
  4. wc -c <fileName>      (Counts only characters)  


  1. wc exm.txt  
  2. wc -l exm.txt  
  3. wc -w exm.txt  
  4. wc -c exm.txt

Linux wc Filters1

Look at the above snapshot, command "wc exm.txt" displays all three counts together, command wc -l exm.txt displays line counts, command "wc -w exm.txt" displays word counts and command "wc -c exm.txt" displays character counts.