← All Posts

Nano Editor Keyboard Shortcuts — Complete Reference

A complete reference for Nano text editor keyboard shortcuts — covering navigation, editing, searching, saving, and file management in Linux/Unix terminals.

Nano is a lightweight, beginner-friendly terminal text editor for Linux and Unix systems. Unlike Vim or Emacs, Nano shows available commands at the bottom of the screen, making it easy to get started. This guide covers every essential shortcut you need.

Nano Editor

ShortcutAction
Ctrl + AJump to the beginning of the current line
Ctrl + EJump to the end of the current line
Ctrl + YScroll one page up
Ctrl + VScroll one page down
Ctrl + _Go to a specific line and column number
Ctrl + CShow current cursor position (line / column / character)

File Operations#

ShortcutAction
Ctrl + OSave (write out) the file — Nano will prompt to confirm the filename
Ctrl + XExit Nano — prompts to save if unsaved changes exist
Ctrl + ROpen a file and insert its contents at the current cursor position

Editing Shortcuts#

ShortcutAction
Ctrl + KCut the entire current line (or selected text) to the cut buffer
Ctrl + UPaste (uncut) text from the cut buffer at the current position
Ctrl + JJustify (reflow) the current paragraph
Ctrl + \Find and replace a string or regular expression
Alt + AToggle text selection mode — combine with Ctrl + K to cut a specific region

Search Shortcuts#

ShortcutAction
Ctrl + WSearch for a phrase in the file
Alt + WRepeat the last search (find next occurrence)

Miscellaneous#

ShortcutAction
Ctrl + GOpen the Help window with a full list of available commands
Ctrl + TInvoke the spell checker (if installed on your system)

Quick Tips#

  • Ctrl + K + U combo — Cut a line with Ctrl + K then paste it elsewhere with Ctrl + U. This is the fastest way to move lines.
  • Multiple cut — Press Ctrl + K multiple times in a row to cut multiple lines into the buffer at once, then paste them all with a single Ctrl + U.
  • Selection + Cut — Use Alt + A to start marking text, move the cursor to select a region, then Ctrl + K to cut only that selection.
  • Go to line — Use Ctrl + _ when you know exactly which line has an error (useful when a compiler reports a line number).

Installing Nano#

Nano is pre-installed on most Linux distributions. If it’s missing, install it with:

Terminal window
# Debian / Ubuntu
sudo apt install nano
# RHEL / CentOS / Fedora
sudo dnf install nano
# macOS (via Homebrew)
brew install nano

Nano is an excellent tool for quick server-side edits, config file changes, and scripting — especially when a graphical editor isn’t available.