$wc
Print newline, word, and byte counts for files.
wc [OPTIONS] [FILE...]Prueba en vivo en la terminal interactiva
Simulación del lado del cliente sin instalación y con respuesta inmediata.
Descripción general y funcionamiento
`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`).
Opciones y banderas comunes
| 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. |
Ejemplos prácticos del mundo real
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.
Comandos de Linux relacionados
Busque patrones de cadenas o expresiones regulares dentro de archivos de texto.
Concatene e imprima el contenido de archivos en la salida estándar.
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.