Bird
0
0

Which of the following is the correct syntax to read the first 10 lines of a file named data.txt in Linux CLI?

easy📝 Syntax Q12 of 15
Linux CLI - Viewing and Editing Files
Which of the following is the correct syntax to read the first 10 lines of a file named data.txt in Linux CLI?
Aread -10 data.txt
Bcat -10 data.txt
Chead -10 data.txt
Dtail -10 data.txt
Step-by-Step Solution
Solution:
  1. Step 1: Recall command for first lines

    The head command shows the first lines; -10 means first 10 lines.
  2. Step 2: Check other options

    cat shows whole file, read is not for this, tail shows last lines.
  3. Final Answer:

    head -10 data.txt -> Option C
  4. Quick Check:

    First 10 lines = head -10 [OK]
Quick Trick: Use head for first lines, tail for last lines [OK]
Common Mistakes:
  • Using cat with -10 option
  • Confusing tail with head
  • Using read command incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes