Difficulty: Easy
Correct Answer: wc -c
Explanation:
Introduction / Context:
The wc utility summarizes textual statistics and is commonly used in scripts and quick checks. Understanding its switches helps you retrieve only the metric you need—lines, words, or bytes/characters—without extra parsing.
Given Data / Assumptions:
Concept / Approach:
wc -c reports the number of bytes in the input. On many systems this corresponds to character count for single-byte encodings. Other key options include -l for lines and -w for words. There is no standard '-r' or '- 1' option; those are distractors. Using the correct flag prevents confusion and enables reliable scripting logic.
Step-by-Step Solution:
Verification / Alternative check:
Compare with stat -c %s file.txt (GNU) which reports size in bytes. The values should match for regular files not involving transformations like newline conversions.
Why Other Options Are Wrong:
Common Pitfalls:
Confusing bytes with characters in multibyte encodings; for true character counts, use locale-aware tools like awk or iconv in combination with wc where appropriate.
Final Answer:
wc -c
Discussion & Comments