Post

Nano Text Editor Cheat Sheet

A quick reference guide for essential GNU Nano text editor commands and shortcuts.

Nano Text Editor Cheat Sheet

πŸ“ 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

ActionShortcut
Start of lineCtrl+A
End of lineCtrl+E
Go to line numberCtrl+/
Delete word leftAlt+Backspace
Delete word rightCtrl+Del
Delete lineAlt+Del
Cut lineCtrl+K
PasteCtrl+U
UndoAlt+U
RedoAlt+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+R and Ctrl+X to switch between files.
  • Enable syntax highlighting by editing your nanorc file 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.

This post is licensed under CC BY 4.0 by the author.