wc
wc
prints newline, word, and byte counts for each FILE
.
$ wc tecmint.txt
12 16 112 tecmint.txt
Useful Options / Examples
wc -l
To count number of newlines in a file use the option -l
, which prints the number of lines from a given file.
$ wc -l tecmint.txt
12 tecmint.txt
wc -w
Using -w
argument with wc
command prints the number of words in a file.
$ wc -w tecmint.txt
16 tecmint.txt
wc -c
Using -c
with wc
command will print the total number of bytes in a file.
$ wc -c tecmint.txt
112 tecmint.txt
wc -m
Using -m
with wc
command will print the total number of characters in a file.
$ wc -m tecmint.txt
112 tecmint.txt
wc -L
The āwcā command allow an argument ā-Lā, it can be used to print out the length of longest (number of characters) line in a file.
$ wc -L tecmint.txt
16 tecmint.txt