May 2017
Beginner
552 pages
28h 47m
English
The wc command supports options to count the number of lines, words, and characters:
$ wc -l file
$ cat file | wc -l
$ wc -w file
$ cat file | wc -w
$ wc -c file
$ cat file | wc -c
To count the characters in a text string, use this command:
echo -n 1234 | wc -c
4
Here, -n deletes the final newline character.
$ wc file
1435 15763 112200
Those are the number of lines, words, and characters.
$ wc file -L
205