100 Useful Command-Line Utilities
by Oliver; 201424. wc
wc counts the number of words, lines, or characters in a file.Count lines:
$ cat myfile.txt aaa bbb ccc ddd
$ cat myfile.txt | wc -l 4Count words:
$ echo -n joe | wc -w 1Count characters:
$ echo -n joe | wc -c 3