Skip to Content
This project is a work in progress. If you have any questions or suggestions, feel free to contact me.

nano Editor

  • nano is a simple and easy-to-use terminal-based text editor.
  • Ideal for quick edits or configuration file changes.
  • Lighter and more intuitive than vim or emacs.

Syntax

nano filename
  • Opens filename for editing.
  • If the file doesn’t exist, it creates a new one.

Basic Navigation

KeyAction
Ctrl + AMove to beginning of line
Ctrl + EMove to end of line
Ctrl + YScroll up one page
Ctrl + VScroll down one page
Ctrl + _Go to specific line and column

Editing Text

  • Use arrow keys to move.
  • Type as you normally would.
  • Supports copy, cut, paste operations.

Saving and Exiting

KeyAction
Ctrl + OWrite out (Save) file
EnterConfirm filename to save
Ctrl + XExit nano
Ctrl + CCancel current action

Cutting, Copying, and Pasting

KeyAction
Ctrl + KCut the current line
Ctrl + UPaste the cut line
Ctrl + ^Set mark (start selection)
Arrow keysExtend selection
Ctrl + KCut selected region

Searching and Replacing

KeyAction
Ctrl + WSearch
Ctrl + \Search and replace
Ctrl + RInsert file contents at cursor

Enabling Line Numbers (optional)

nano -c filename
  • Shows the current cursor position.

Example: Edit /etc/hosts

sudo nano /etc/hosts
  • Make changes to the hosts file, save with Ctrl + O, exit with Ctrl + X.

Summary of Common Shortcuts

ShortcutDescription
Ctrl + OSave (write out)
Ctrl + XExit
Ctrl + KCut line or region
Ctrl + UPaste
Ctrl + WSearch
Ctrl + \Replace
Ctrl + ^Start marking selection
Ctrl + GHelp
Last updated on