Category: Advanced – Command Line • Est. reading time: 1 minute
The wc command counts what is in a text file: lines, words, and bytes.
Standard usage
Run on its own, wc prints all three counts at once, in the order lines, words, bytes:
wc file.txt # => 11 22 33 file.txt
That reads as 11 lines, 22 words, and 33 bytes. For plain ASCII text, the byte count and character count are the same.
Count just one thing
wc -l file.txt # lines
wc -w file.txt # words
wc -m file.txt # characters
wc -c file.txt # bytes
Running your own dedicated or self-managed server? We are glad to help. Reach us at support@allydrez.com or 1-321-209-2004.