Course
Free Trial: 5 lessons remaining
Unlock Full Access
Practice
Beginner
10 min
The Great Escape: How to Exit Vim
Basic Text Editing
Task Instructions
Learn the legendary :wq command - save your work and exit like a pro!
To complete this lesson, you need to save and exit Vim using :wq. Yes, this will end your browser Vim session - that's exactly what should happen! We keep everyone in Vim for safety, so exiting means you're done. Press Escape to ensure you're in Normal Mode, then type :wq and press Enter.
Learning objectives
- Learn how to save and exit Vim with :wq
- Understand why the session ends (it's a feature, not a bug!)
- Gain confidence that breaking the session is the correct answer
- Join the ranks of those who know how to save and exit Vim
Required keystrokes
Your submission is checked for these keystrokes, not just the final text — so reach for the technique, not a workaround.
- :wq Save and exit Vim using :wq
Helpful commands
- :q
- Quit Vim (when no unsaved changes)
- :q!
- Force quit without saving changes
- :wq
- Save and quit
- :x
- Save and quit (shorthand)
- ZZ
- Save and quit (no colon needed)
Stuck? Peek at a hint 3 hints · try it on your own first
- Press Escape first to make sure you're in Normal Mode
- Type :wq (colon then w then q) and press Enter
- When the session ends, that means you did it right!
Congratulations! You've been editing in Vim like a pro.
Now comes the moment of truth - saving and exiting Vim.
Yes, we know about the memes. But here's the thing:
In our browser-based environment, you're ALWAYS in Vim.
Why? Because we don't let anyone touch the Linux system
without being safely wrapped in our Vim editor.
So when you type :wq to save and exit, your session will end.
And that's totally OK! It means you've learned the way.
To save your work and exit Vim to complete this lesson:
1. Make sure you're in Normal Mode (press Escape)
2. Type :wq and press Enter (w = write/save, q = quit)
3. Your session will end (don't panic!)
4. You can submit and move forward
Remember: Every Vim user has googled 'how to exit vim'.
You're in good company!