wc CommandIntroduction to the Linux Word Count Command
By Zaheer Udin K00287263
wc stands for "word count" and is a command-line tool in Unix/Linux systems.
It is used to count lines, words, and bytes/characters in text files.
General syntax for the wc command:
wc [options] [file]
Common options:
-l : Count lines-w : Count words-c : Count bytes (characters)-m : Count characters (useful for UTF-8)Basic example of wc:
echo "Hello World" | wc
Output: 1 2 11 (1 line, 2 words, 11 characters)
Another example to count lines in a file:
wc -l my-file.txt
Output: Number of lines in my-file.txt.
wc with Other CommandsYou can combine wc with other Linux commands. For example:
ls | wc -l
This counts how many files/folders are in the current directory.
For more details, refer to the manual:
man wc
The manual explains all options, including additional ones like -L (find longest line).
-m for multi-byte characters (like
UTF-8)For more information, see the wc command manual.
Built using reveal.js