Bird
0
0

What will be the output of this command?

medium📝 Command Output Q4 of 15
Linux CLI - Pipes and Redirection
What will be the output of this command?
echo "one two three" | tr ' ' '\n' | wc -l
A0
B3
C1
DError
Step-by-Step Solution
Solution:
  1. Step 1: Break down the command

    echo "one two three" outputs the string. tr ' ' '\n' replaces spaces with new lines, making three lines. wc -l counts lines.
  2. Step 2: Calculate output

    There are three words, so after splitting by new lines, wc -l counts 3 lines.
  3. Final Answer:

    3 -> Option B
  4. Quick Check:

    Pipe output flows correctly = 3 lines [OK]
Quick Trick: Pipe output transforms step-by-step, count lines last [OK]
Common Mistakes:
  • Counting words instead of lines
  • Ignoring tr command effect
  • Expecting error due to escape characters

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes