The wc command
Count lines, words and bytes. Prints the number of lines, words and bytes in each file (and a total when there is more than one), or in what is piped into it.
Usage
wc [OPTION]... [FILE]...
Options
| -l, --lines | only the number of lines |
|---|---|
| -w, --words | only the number of words |
| -c, --bytes | only the number of bytes |
| -m, --chars | only the number of characters |
Examples
wc notes.txtLines, words and byteswc -l *.txtLines in each text file, plus a totalls | wc -lHow many entries ls printed
Learn it step by step
Related commands
learner@sandbox: ~bash (practice)
Note: Try wc here: your home directory has sample files. Press Try beside an example, or type your own.
Enter runs · Tab completes names · ↑ ↓ step through history · Ctrl+L clears · type help for every command
A practice shell in your browser that behaves like bash on Linux for these commands. Nothing you type leaves the page.