Bird
0
0

You open a file in Vim, press i, type 'Sample', then press Esc and enter :wq. What is the result?

medium📝 Command Output Q4 of 15
Linux CLI - Viewing and Editing Files
You open a file in Vim, press i, type 'Sample', then press Esc and enter :wq. What is the result?
AThe text 'Sample' is discarded and Vim exits.
BThe text 'Sample' is saved and Vim exits.
CVim shows an error and stays open.
DThe file is saved but Vim remains open.
Step-by-Step Solution
Solution:
  1. Step 1: Insert text

    Pressing i enters insert mode, typing 'Sample' adds text.
  2. Step 2: Exit insert mode

    Pressing Esc returns to normal mode.
  3. Step 3: Save and quit

    Typing :wq writes changes and quits Vim.
  4. Final Answer:

    The text 'Sample' is saved and Vim exits. -> Option B
  5. Quick Check:

    Insert, Esc, then :wq saves and quits [OK]
Quick Trick: Insert text, Esc, then :wq to save and quit [OK]
Common Mistakes:
MISTAKES
  • Forgetting to press Esc before :wq
  • Using :q without saving
  • Assuming :wq discards changes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes