Difficulty: Easy
Correct Answer: wc
Explanation:
Introduction / Context:
Quickly summarizing the size of text files is a common need for developers, data engineers, and sysadmins. UNIX provides a compact utility for this: wc (word count). It can be combined with options and pipelines to provide precise metrics in scripts and investigations.
Given Data / Assumptions:
Concept / Approach:
wc reports counts; options like -l, -w, -c (or -m) select lines, words, and bytes/characters respectively. Without options, wc prints all three counts followed by the filename. It is often used in shell pipelines to measure the output of other commands.
Step-by-Step Solution:
Verification / Alternative check:
Spot-check by manually counting a small file’s lines and words to confirm wc behavior. Use hexdump or od to explore byte counts for encodings.
Why Other Options Are Wrong:
a, c, d: Not standard UNIX utilities.
e: Not applicable because wc is correct.
Common Pitfalls:
Confusing bytes (-c) with characters (-m) in multibyte locales; forgetting to quote file patterns; relying on wc behavior across different UNIX variants without checking man pages.
Final Answer:
wc
Discussion & Comments