Linux › Module 2 › Lesson 3
Text Editors (nano, vim basics)
Edit config files and scripts with nano and vim basics
Opening
Configs live in text files
On Linux you will edit SSH settings, scripts, and notes without Notepad. Two editors show up everywhere: nano (friendly) and vim (powerful). Learn both names—even if you mostly use nano at first.
1. nano — Start Here
Open a file: nano notes.txt Shortcuts appear at the bottom (^ means Ctrl): Ctrl+O — save (write Out) Ctrl+X — exit Ctrl+K — cut line Ctrl+U — paste line
Real workflow
Need to fix a typo in /etc/hosts on a server? sudo nano /etc/hosts, edit, save, exit. Always use sudo only when the file requires root.
2. vim — Modal Editing
vim opens in Normal mode—you do not type text immediately. Open: vim script.sh Press i — insert mode (type text) Press Esc — back to Normal mode Type :wq — write (save) and quit Type :q! — quit without saving
3. Why vim Still Matters
Everywhere
vim (or vi) is installed on minimal servers where nano might not exist.
Speed
Once learned, editing without a mouse is faster for logs and configs.
Rescue mode
When a GUI fails, vi still works over SSH.
4. Which Should You Use?
Use nano while learning. Practice vim 5 minutes a day until :wq feels natural. Many pros use both—nano for quick edits, vim for heavy log diving.
Knowledge Check
In nano, which shortcut saves the file?
Multiple choice
Knowledge Check
In vim, what do you press first to start typing new text?
Multiple choice
Knowledge Check
Which command opens notes.txt in nano?
Multiple choice