Difficulty: Easy
Correct Answer: None of the above
Explanation:
Introduction / Context:
In UNIX, a “filter” is a program designed to read from standard input and write to standard output, making it easy to combine tools using pipelines. Recognizing which commands act as filters helps build effective command-line workflows.
Given Data / Assumptions:
|
operator.
Concept / Approach:
Commands like cat
, grep
, wc
, and sort
all read from standard input (if no file is provided) and write to standard output. Therefore, each of these is usable as a filter in pipelines, meaning none of the listed commands is “not a filter.”
Step-by-Step Solution:
Test each command with a pipe: e.g., cat file | grep pattern | sort | wc -l.Observe that each command consumes stdin and emits stdout.Conclude that all given commands qualify as filters.
Verification / Alternative check:
Run man pages (e.g., man grep, man sort) to confirm stdin/stdout usage. Try echo "text" | cat, echo "text" | wc, etc., verifying their filter behavior.
Why Other Options Are Wrong:
Options A–D: Each listed command is a valid filter. cat
concatenates and passes through data; grep
filters by pattern; wc
counts lines/words/chars; sort
orders lines.
Common Pitfalls:
Final Answer:
None of the above
Discussion & Comments