line
Read one line from standard input
TLDR
Read input
SYNOPSIS
wc [OPTION]... [FILE]...
PARAMETERS
`-c`, `--bytes`
Print the byte counts.
`-m`, `--chars`
Print the character counts.
`-l`, `--lines`
Print the newline counts.
`-w`, `--words`
Print the word counts.
`-L`, `--max-line-length`
Print the length of the longest line.
`--help`
Display help information and exit.
`--version`
Output version information and exit.
[FILE]
The file(s) to process. If no file is specified, or if FILE is '-', read standard input.
DESCRIPTION
The `wc` command in Linux is a utility used to count the number of lines, words, and characters (bytes) in a file or standard input. It's a simple yet powerful tool for basic text analysis and can be used in scripts and pipelines to extract information about file sizes and content. The default behavior is to print all three counts, along with the filename (if provided). Options allow you to control which counts are displayed and can significantly impact the output. It's frequently used for quick checks on log files, text documents, and code.
CAVEATS
When processing multiple files, `wc` will also provide a 'total' line at the end, summarizing the counts for all files.
The definition of a 'word' can vary depending on the locale. By default, it's based on whitespace separation.
STANDARD INPUT
If no file is specified as an argument, `wc` reads from standard input. This makes it useful in pipelines.
Example: `cat file.txt | wc -w` counts the words in `file.txt`.
RETURN VALUE
The `wc` command returns 0 on success and a non-zero value on failure (e.g., if it cannot open a file).
HISTORY
The `wc` command has been a standard utility in Unix-like operating systems for a very long time. It's part of the coreutils package in GNU/Linux distributions, ensuring its widespread availability. Its function has remained remarkably consistent throughout its history, proving its utility for basic text manipulation tasks.