Bird
0
0

What happens when you run nano myfile.txt if myfile.txt does not exist?

medium📝 Command Output Q13 of 15
Linux CLI - Viewing and Editing Files
What happens when you run nano myfile.txt if myfile.txt does not exist?
Anano creates a new empty file named myfile.txt for editing
Bnano shows an error and exits
Cnano opens a random file
Dnano opens the last edited file
Step-by-Step Solution
Solution:
  1. Step 1: Understand nano file behavior

    If the file does not exist, nano creates a new empty buffer with that filename.
  2. Step 2: Check other options

    It does not error out, open random or last file.
  3. Final Answer:

    nano creates a new empty file named myfile.txt for editing -> Option A
  4. Quick Check:

    Nonexistent file opens empty new file = A [OK]
Quick Trick: nano creates new file if it doesn't exist [OK]
Common Mistakes:
MISTAKES
  • Expecting an error if file is missing
  • Thinking nano opens a random file
  • Assuming nano opens last file automatically

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes