Bird
0
0

Why is it important to use 2> or 2>> instead of just > when redirecting error messages?

hard📝 Conceptual Q10 of 15
Linux CLI - Pipes and Redirection
Why is it important to use 2> or 2>> instead of just > when redirecting error messages?
ABecause 2> and 2>> specifically redirect standard error, while > redirects standard output
BBecause > redirects both output and errors by default
CBecause 2> redirects standard output and 2>> redirects errors
DBecause > is deprecated for error redirection
Step-by-Step Solution
Solution:
  1. Step 1: Understand file descriptors

    File descriptor 1 is standard output, 2 is standard error.
  2. Step 2: Differentiate redirection operators

    '>' redirects stdout (fd 1), '2>' redirects stderr (fd 2).
  3. Final Answer:

    2> and 2>> redirect errors; > redirects output -> Option A
  4. Quick Check:

    2> targets errors, > targets output = C [OK]
Quick Trick: 2> redirects errors; > redirects normal output [OK]
Common Mistakes:
  • Assuming > redirects errors too
  • Confusing file descriptor numbers
  • Thinking > is deprecated

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes