Bird
0
0

Why does wc -c sometimes show a different count than wc -m for the same file?

hard📝 Conceptual Q10 of 15
Linux CLI - Viewing and Editing Files
Why does wc -c sometimes show a different count than wc -m for the same file?
A<code>-c</code> counts bytes, <code>-m</code> counts characters (handles multibyte)
B<code>-c</code> counts characters, <code>-m</code> counts words
C<code>-c</code> counts lines, <code>-m</code> counts characters
D<code>-c</code> counts words, <code>-m</code> counts bytes
Step-by-Step Solution
Solution:
  1. Step 1: Understand difference between bytes and characters

    -c counts raw bytes, -m counts characters, which may be multiple bytes (e.g., UTF-8).
  2. Step 2: Explain why counts differ

    Files with multibyte characters have byte count > character count, causing difference.
  3. Final Answer:

    -c counts bytes, -m counts characters (handles multibyte) -> Option A
  4. Quick Check:

    Bytes vs characters difference explains count mismatch [OK]
Quick Trick: Use -m for characters, -c for bytes [OK]
Common Mistakes:
MISTAKES
  • Confusing bytes with characters
  • Assuming both options count the same
  • Mixing up words and characters

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes