Multiple choice unix

Which command is used to count just the number of characters in a file?

  1. wc - 1

  2. wc -c

  3. wc -w

  4. wc -r

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

wc -c counts the number of bytes (characters) in a file. wc -l counts lines, wc -w counts words. There is no standard wc -r or wc - 1 option.

AI explanation

The -c option to wc reports the byte/character count of a file, which is what's being asked for here. -w counts words and a bare wc (or an option like -l) counts lines instead, so they measure different units of the same file. There is no standard -r option for wc, and wc - 1 is not valid syntax for a character count.