$wc
Print newline, word, and byte counts for files.
wc [OPTIONS] [FILE...]Live im interaktiven Terminal ausprobieren
Client-seitige Simulation ohne Installation mit sofortigem Feedback.
Überblick & Funktionsweise
`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`).
Wichtige Optionen und Flags
| 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. |
Praktische Anwendungsbeispiele
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.
Verwandte Linux-Befehle
Suchen Sie nach Zeichenfolgenmustern oder regulären Ausdrücken in Textdateien.
Dateiinhalte verketten und auf der Standardausgabe ausgeben.
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.