Nano is a simple and intuitive command-line text editor, perfect for quick editing of configuration files.
📂 Launch & Files
📌 Action 🧠 Command ✍️ Open a file nano file.txt➕ Open multiple files nano file1.txt file2.txt📄 Open at a specific line nano +42 file.txt🔒 Open in read-only mode nano -v file.txt📏 Show line numbers nano -l file.txt
⌨️ Movement & Navigation
📌 Action 🧠 Shortcut ↖️ Beginning of line Ctrl + A↘️ End of line Ctrl + E🔝 Beginning of file Ctrl + Y🔚 End of file Ctrl + V🔎 Go to line Ctrl + _ then number📄 Next page Ctrl + V📄 Previous page Ctrl + Y
📝 Text Editing
📌 Action 🧠 Shortcut ✂️ Cut line Ctrl + K📋 Paste Ctrl + U📌 Mark selection start Ctrl + ^🗂️ Copy selection Alt + 6❌ Delete character Ctrl + D↩️ Undo Alt + U🔁 Redo Alt + E📝 Indent line Alt + }📝 Unindent line Alt + {
🔍 Search & Replace
📌 Action 🧠 Shortcut 🔍 Search Ctrl + W⏭️ Find next Alt + W⏮️ Find previous Alt + Q🔄 Search & replace Ctrl + \🔄 Replace all Ctrl + \ then A
💾 Save & Exit
📌 Action 🧠 Shortcut 💾 Save Ctrl + O💾 Save as Ctrl + O then new name❌ Quit Ctrl + X🔒 Quit without saving Ctrl + X then N✅ Save and quit Ctrl + X then Y
🛠️ Useful Functions
📌 Action 🧠 Shortcut 🔢 Show/Hide line numbers Alt + N📖 Justify paragraph Ctrl + J🧮 Spell check Ctrl + T🪟 New buffer Ctrl + R↔️ Next buffer Alt + >↔️ Previous buffer Alt + <ℹ️ Help Ctrl + G
🔧 Launch Options
# Edit with line numbering
nano -l file.txt
# Edit with automatic backup
nano -B file.txt
# Create backup with custom extension
nano -B -S .bak file.txt
# Read-only mode
nano -v file.txt
# Disable word wrap
nano -w file.txt
💡 Practical Tips
🔍 Search with regex
# Enable regex in search
Alt + R (in search prompt )
📋 Advanced copy/paste
# Mark a zone then copy
Ctrl + ^ → select → Alt + 6 → Ctrl + U (paste)
🎯 Multi-file editing
# Open multiple files
nano file1.txt file2.txt file3.txt
# Navigate between files
Alt + > (next) or Alt + < ( previous )