Nano Text Editor Cheat Sheet
A quick reference guide for essential GNU Nano text editor commands and shortcuts.
π GNU Nano Developer Shortcut Guide
Nano is a lightweight terminal text editor widely used by developers for quick edits.
This guide covers essential shortcuts for navigation, editing, file handling, and productivity.
π Navigation Shortcuts
- Start of line β
Ctrl+A - End of line β
Ctrl+E - Next word β
Ctrl+Space - Previous word β
Alt+Space - Forward one character β
Ctrl+F - Backward one character β
Ctrl+B - Go to specific line number β
Ctrl+/ - Next page β
Ctrl+V - Previous page β
Ctrl+Y
Usage:
Use these shortcuts to move quickly through code or configuration files without relying on arrow keys.
βοΈ Editing & Deletion
- Delete character before cursor β
Ctrl+H - Delete character under cursor β
Ctrl+D - Delete word left β
Alt+Backspace - Delete word right β
Ctrl+Del - Delete current line β
Alt+Del - Cut current line β
Ctrl+K - Copy current line β
Alt+6 - Paste cutbuffer β
Ctrl+U
Usage:
These are vital for developers editing code snippets, removing unnecessary lines, or restructuring text quickly.
π File Handling
- Save current file β
Ctrl+S - Write file (Save As) β
Ctrl+O - Insert another file β
Ctrl+R - Exit Nano β
Ctrl+X
Usage:
When working on multiple files, Ctrl+R lets you insert content from another file directly into the current buffer.
π Search & Replace
- Forward search β
Ctrl+F - Backward search β
Ctrl+B - Replace text β
Alt+R - Find next occurrence forward β
Alt+F - Find next occurrence backward β
Alt+B
Usage:
Perfect for finding function names, variables, or replacing repeated code patterns.
π Developer-Friendly Operations
- Undo last action β
Alt+U - Redo last undone action β
Alt+E - Comment/uncomment line/region β
Alt+3 - Spell check β
Ctrl+T Ctrl+S - Syntax check β
Ctrl+T Ctrl+Y - Formatter β
Ctrl+T Ctrl+O - Indent marked region β
Tab - Unindent marked region β
Shift+Tab
Usage:
These shortcuts help maintain clean code formatting and allow quick commenting/uncommenting during debugging.
π Quick Reference Table
| Action | Shortcut |
|---|---|
| Start of line | Ctrl+A |
| End of line | Ctrl+E |
| Go to line number | Ctrl+/ |
| Delete word left | Alt+Backspace |
| Delete word right | Ctrl+Del |
| Delete line | Alt+Del |
| Cut line | Ctrl+K |
| Paste | Ctrl+U |
| Undo | Alt+U |
| Redo | Alt+E |
β Tips for Developer
- Use marking (
Ctrl+^) to select text before cutting/copying. - Combine search + replace to refactor variable names quickly.
- Keep multiple buffers open with
Ctrl+RandCtrl+Xto switch between files. - Enable syntax highlighting by editing your
nanorcfile for better readability.
π Conclusion
Mastering these shortcuts makes Nano a powerful tool for developers working directly in the terminal.
Itβs especially useful for quick edits to scripts, configs, or code without needing a full IDE.
