skip to content

Search

Syspirit
EN

Nano

File editing with the Nano editor - essential shortcuts and commands!

Linux
Published on

Nano is a simple and intuitive command-line text editor, perfect for quick editing of configuration files.

📂 Launch & Files

📌 Action🧠 Command
✍️ Open a filenano file.txt
➕ Open multiple filesnano file1.txt file2.txt
📄 Open at a specific linenano +42 file.txt
🔒 Open in read-only modenano -v file.txt
📏 Show line numbersnano -l file.txt

⌨️ Movement & Navigation

📌 Action🧠 Shortcut
↖️ Beginning of lineCtrl + A
↘️ End of lineCtrl + E
🔝 Beginning of fileCtrl + Y
🔚 End of fileCtrl + V
🔎 Go to lineCtrl + _ then number
📄 Next pageCtrl + V
📄 Previous pageCtrl + Y

📝 Text Editing

📌 Action🧠 Shortcut
✂️ Cut lineCtrl + K
📋 PasteCtrl + U
📌 Mark selection startCtrl + ^
🗂️ Copy selectionAlt + 6
❌ Delete characterCtrl + D
↩️ UndoAlt + U
🔁 RedoAlt + E
📝 Indent lineAlt + }
📝 Unindent lineAlt + {

🔍 Search & Replace

📌 Action🧠 Shortcut
🔍 SearchCtrl + W
⏭️ Find nextAlt + W
⏮️ Find previousAlt + Q
🔄 Search & replaceCtrl + \
🔄 Replace allCtrl + \ then A

💾 Save & Exit

📌 Action🧠 Shortcut
💾 SaveCtrl + O
💾 Save asCtrl + O then new name
❌ QuitCtrl + X
🔒 Quit without savingCtrl + X then N
✅ Save and quitCtrl + X then Y

🛠️ Useful Functions

📌 Action🧠 Shortcut
🔢 Show/Hide line numbersAlt + N
📖 Justify paragraphCtrl + J
🧮 Spell checkCtrl + T
🪟 New bufferCtrl + R
↔️ Next bufferAlt + >
↔️ Previous bufferAlt + <
ℹ️ HelpCtrl + 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)