$wc
Print newline, word, and byte counts for files.
wc [OPTIONS] [FILE...]Essayer en direct dans le bac à sable interactif
Simulation côté client sans installation avec retour instantané.
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 / 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. |
Exemples pratiques du monde réel
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.
Commandes Linux associées
Rechercher des motifs de chaînes ou des expressions régulières dans des fichiers texte.
Concaténer et afficher le contenu des fichiers sur la sortie standard.
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.