$wc
Print newline, word, and byte counts for files.
wc [OPTIONS] [FILE...]Попробуйте в интерактивной песочнице
Клиентская симуляция без установки с мгновенным результатом.
Обзор и принцип работы
`wc` (Word Count) reads files or standard input and computes statistics including line count (`-l`), word count (`-w`), and byte count (`-c`). It is widely used in shell pipelines to count query results or filter matches (e.g., `grep ... | wc -l`).
Основные флаги и параметры команды
| Flag / Option | Description |
|---|---|
| -l | Count and print total newline line counts. |
| -w | Count and print total words. |
| -c | Count and print total bytes. |
| -m | Count and print total characters. |
Практические примеры использования
wc -l welcome.txtOutputs the line count for welcome.txt.
grep "error" /var/log/syslog | wc -lPipes grep output into wc -l to get the exact integer count.
Похожие команды Linux
Поиск текстовых шаблонов и регулярных выражений внутри файлов и потоков данных.
Чтение и объединение содержимого файлов с выводом в терминал.
Output the first part (top lines) of text files.
Output the last part (bottom lines) of files or stream real-time logs.
Print text strings or write data to files using shell redirection.
Stream editor for filtering and transforming text using pattern substitutions.