Bird
0
0

You run head -n5 file.txt but get an error: "head: invalid option -- 'n5'". What is the likely cause?

medium📝 Debug Q6 of 15
Linux CLI - Viewing and Editing Files
You run head -n5 file.txt but get an error: "head: invalid option -- 'n5'". What is the likely cause?
AFile does not exist
BMissing space between -n and 5
Chead command does not support -n option
DFile is empty
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the error message

    The error says invalid option -- 'n5', indicating the option was combined incorrectly.
  2. Step 2: Check the syntax of the command

    The correct syntax requires a space between -n and the number: head -n 5 file.txt.
  3. Final Answer:

    Missing space between -n and 5 -> Option B
  4. Quick Check:

    Options need spaces: -n 5, not -n5 [OK]
Quick Trick: Always put space between option and number [OK]
Common Mistakes:
MISTAKES
  • Writing -n5 instead of -n 5
  • Assuming file missing causes option error
  • Using wrong command

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes