Online Linux Terminal Logo
OnlineLinuxTerminal
Обработка текстаCLI Manual

$wc

Print newline, word, and byte counts for files.

Синтаксис командыPOSIX Standard
wc [OPTIONS] [FILE...]
Сообщество Linux2.4k Онлайн

Общайтесь с пользователями Linux, учите команды и скачивайте шпаргалки.

Попробуйте в интерактивной песочнице

Клиентская симуляция без установки с мгновенным результатом.

Открыть в полноэкранном терминале ↗
bash — terminal

Обзор и принцип работы

`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 / OptionDescription
-lCount and print total newline line counts.
-wCount and print total words.
-cCount and print total bytes.
-mCount and print total characters.

Практические примеры использования

#1Count total lines in a file
wc -l welcome.txt

Outputs the line count for welcome.txt.

#2Count matching error occurrences in logs
grep "error" /var/log/syslog | wc -l

Pipes grep output into wc -l to get the exact integer count.