Word Count (WC) Linux Commands

What is Linux Word Count (WC) Command?

Explanation

Word Count (WC) COMMAND:

Word Count (Wc) command counts and displays the number of lines, words, character and number of bytes enclosed in a file.

SYNTAX :


wc [filename]

OPTIONS:


-c print the byte counts
-m, --chars print the character counts switch.
-l, --lines print the newline counts
-L, --max-line-length print the length of the longest line
-w, --words print the word counts
--help display this help and exit
--version output version information and exit

EXAMPLE:


  1. wc test.txt
    Output:
    4 18 102 test.txt
    4 = Lines 18 = Words 102 = Bytes
  2. In the above example, the word count cmd counts and displays the number of lines, words, bytes in the file test.txt.

Ask Questions

Ask Question