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
- Number of characters
- Number of words
- 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