Bird
0
0

What does the command cat < file.txt do in Linux?

easy📝 Conceptual Q1 of 15
Linux CLI - Pipes and Redirection
What does the command cat < file.txt do in Linux?
AWrites the contents of file.txt to a new file
BReads the contents of file.txt and displays it on the screen
CDeletes the file.txt
DCreates a new empty file named file.txt
Step-by-Step Solution
Solution:
  1. Step 1: Understand stdin redirection with <

    The < symbol redirects input from a file to a command instead of the keyboard.
  2. Step 2: Apply to the cat command

    cat reads from stdin by default, so using < file.txt makes cat read from file.txt and print its contents.
  3. Final Answer:

    Reads the contents of file.txt and displays it on the screen -> Option B
  4. Quick Check:

    stdin redirection < = input from file [OK]
Quick Trick: Use < to feed file content as input to commands [OK]
Common Mistakes:
  • Confusing < with output redirection >
  • Thinking it deletes or creates files
  • Assuming it modifies the file content

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes