5. You want to count only the characters (not bytes) in a UTF-8 encoded file data.txt. Which command should you use?
hard
A. wc -c data.txt
B. wc -w data.txt
C. wc -l data.txt
D. wc -m data.txt
Solution
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.
Step 2: Choose correct option for character count
To count characters (not bytes), use wc -m.
Final Answer:
wc -m data.txt -> Option D
Quick Check:
-m counts characters, not bytes [OK]
Hint: Use -m for characters, -c counts bytes (important for UTF-8) [OK]
Common Mistakes:
Using -c and expecting character count
Confusing words (-w) with characters
Ignoring UTF-8 multibyte character effects
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.