Bird
0
0

Which of the following is the correct syntax to display the contents of a file named example.txt?

easy📝 Syntax Q3 of 15
Linux CLI - Viewing and Editing Files
Which of the following is the correct syntax to display the contents of a file named example.txt?
Acat example.txt
Bcat -x example.txt
Ccat > example.txt
Dcat example.txt -n
Step-by-Step Solution
Solution:
  1. Step 1: Recall the basic syntax of cat

    The basic syntax to display a file is cat filename.
  2. Step 2: Check each option for correctness

    cat example.txt uses the correct syntax. cat -x example.txt uses an invalid option -x. cat > example.txt uses redirection which overwrites the file. cat example.txt -n places -n incorrectly.
  3. Final Answer:

    cat example.txt -> Option A
  4. Quick Check:

    Correct syntax = cat filename [OK]
Quick Trick: Use cat filename to display file content simply [OK]
Common Mistakes:
  • Using invalid options
  • Misplacing options after filename
  • Using redirection instead of display

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes