Bird
0
0

You want to count only the characters (not bytes) in a UTF-8 encoded file data.txt. Which command should you use?

hard📝 Application Q15 of 15
Linux CLI - Viewing and Editing Files
You want to count only the characters (not bytes) in a UTF-8 encoded file data.txt. Which command should you use?
Awc -c data.txt
Bwc -w data.txt
Cwc -l data.txt
Dwc -m data.txt
Step-by-Step Solution
Solution:
  1. Step 1: Understand difference between -c and -m

    -c counts bytes, which may differ from characters in UTF-8 files because some characters use multiple bytes.
    -m counts characters, correctly handling multibyte UTF-8 characters.
  2. Step 2: Choose correct option for character count

    To count characters (not bytes), use wc -m.
  3. Final Answer:

    wc -m data.txt -> Option D
  4. Quick Check:

    -m counts characters, not bytes [OK]
Quick Trick: Use -m for characters, -c counts bytes (important for UTF-8) [OK]
Common Mistakes:
MISTAKES
  • Using -c and expecting character count
  • Confusing words (-w) with characters
  • Ignoring UTF-8 multibyte character effects

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes