Bird
0
0

Given a file numbers.txt containing the lines:

medium📝 Command Output Q13 of 15
Linux CLI - Pipes and Redirection
Given a file numbers.txt containing the lines:
3
1
2

What is the output of the command sort < numbers.txt?
A1 2 3
B3 1 2
C2 3 1
DSyntax error
Step-by-Step Solution
Solution:
  1. Step 1: Understand the input file content

    The file numbers.txt has three lines: 3, 1, and 2.
  2. Step 2: Effect of sort < numbers.txt

    The sort command reads the lines and outputs them sorted ascending: 1, 2, 3.
  3. Final Answer:

    1 2 3 -> Option A
  4. Quick Check:

    sort command sorts lines from stdin [OK]
Quick Trick: Sort reads from stdin when using < redirection [OK]
Common Mistakes:
  • Assuming output is original order
  • Confusing input and output redirection
  • Expecting numbers sorted numerically without options

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes