Linux Commands Helper
💬 Your AI-powered Linux assistant
wc Command - Print Newline, Word, and Byte Counts
The wc command is used to count lines, words, and bytes in files or standard input. It is commonly used in text processing and scripting.
Syntax
wc [options] [file...]
Examples
wc file.txt
Print the number of lines, words, and bytes in file.txt.
wc -l file.txt
Print only the number of lines in file.txt.
cat file.txt | wc -w
Count the number of words in file.txt using a pipeline.
Notes
- Use
-c
for byte count,-w
for word count,-l
for line count. - Can be combined with
cat
andgrep
for advanced text processing. - If no file is specified, wc reads from standard input.