wc
Quick Reference
Command Name:
wc
Category:
text processing
Platform:
Linux/Unix
Basic Usage:
Common Use Cases
Syntax
wc [OPTION]... [FILE]...
Options
Option | Description |
---|---|
-c, --bytes |
Print the byte counts |
-m, --chars |
Print the character counts |
-l, --lines |
Print the newline counts |
-L, --max-line-length |
Print the length of the longest line |
-w, --words |
Print the word counts |
--help |
Display help information and exit |
--version |
Output version information and exit |
Output Format
By default, wc displays four columns of information in this order:
Column | Information |
---|---|
1 | Number of lines |
2 | Number of words |
3 | Number of bytes |
4 | Filename (if provided) |
When multiple files are provided, wc displays the counts for each file and a total line at the end.
Examples
How to Use These Examples
The examples below show common ways to use the wc
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.