Online Linux Terminal Logo
OnlineLinuxTerminal
Traitement de texteCLI Manual

$wc

Print newline, word, and byte counts for files.

Syntaxe de la commandePOSIX Standard
wc [OPTIONS] [FILE...]
Communauté Linux2.4k En ligne

Échangez avec des utilisateurs Linux, apprenez des commandes et téléchargez des PDF.

Essayer en direct dans le bac à sable interactif

Simulation côté client sans installation avec retour instantané.

Ouvrir dans le terminal plein écran ↗
bash — terminal

Aperçu et fonctionnement

`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`).

Options et drapeaux courants

Flag / OptionDescription
-lCount and print total newline line counts.
-wCount and print total words.
-cCount and print total bytes.
-mCount and print total characters.

Exemples pratiques du monde réel

#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.