Skip to content
Go back

Essential GNU Nano Text Editor Key Bindings

Published:

View full cheat -sheet


Essential GNU Nano Text Editor Key Bindings

Nano is a user-friendly, command-line text editor known for its simplicity. Its key bindings are displayed at the bottom of the screen, but knowing the most useful ones by heart will make you much faster.

Note: In Nano, the ^ symbol represents the Ctrl key. So ^X means Ctrl+X. The M- symbol represents the Meta key, which is usually Alt or Esc.

Basic File Operations

Key BindingDescription
Ctrl + XExit Nano. It will prompt to save if the buffer is modified.
Ctrl + OWrite (Save) the current file to disk. You will be prompted for a filename.
Ctrl + SSave the file without prompting (works in many cases).
Ctrl + RInsert another file into the current one.
Ctrl + TSpell Check the text (if spell check is supported).

Cursor Navigation

Key BindingDescription
Ctrl + FMove cursor Forward one character.
Ctrl + BMove cursor Back one character.
Ctrl + PMove to the Previous line.
Ctrl + NMove to the Next line.
Ctrl + AMove to the Beginning of the current line.
Ctrl + EMove to the End of the current line.
Ctrl + SpaceMove forward one word.
Alt + SpaceMove backward one word.
Ctrl + _Go to specific line and column number.
Ctrl + \Search for a string (pattern). Alt + W to find next.

Text Editing

Key BindingDescription
Ctrl + DDelete the character under the cursor.
Ctrl + HDelete the character to the left of the cursor (Backspace).
Ctrl + KCut the entire current line (or marked region).
Ctrl + UPaste (Uncut) the last cut line(s) at the cursor position.
Alt + UUndo the last action.
Alt + ERedo the last undone action.
Alt + AStart marking (selecting) text. Use navigation keys to highlight.
Alt + 6Copy the marked text instead of cutting it.
Alt + TCut until the end of the file from the cursor.

Advanced Operations

Key BindingDescription
Ctrl + CShow Cursor Position (line/column/character count).
Ctrl + GShow Help (displays all key bindings!).
Alt + 3Comment/Uncomment the current line (or marked region).
Alt + YSyntax Highlighting on/off.
Alt + PShow/Hide the formatting toolbar at the bottom.
Alt + XShow/Hide the help lines at the bottom.
Alt + CShow/Hide the cursor position in real-time.
TabIndent the current line (or marked region).
Shift + TabUnindent the current line (or marked region).

Search and Replace

Key BindingDescription
Ctrl + WSearch for a string.
Alt + WFind Next occurrence after a search.
Ctrl + \Search and Replace. You will be prompted for the search term and its replacement.

Pro Tips for Nano

These bindings will help you navigate and edit files in Nano with much greater speed and confidence.


Suggest Changes

Next Post
Local Node.js App with HTTPS on Ubuntu 22.04 Using Self-Signed SSL, Nginx & Apache Reverse Proxy