Nano Keyboard Shortcuts

Complete Nano keyboard shortcuts reference — 66 shortcuts across 9 categories. Quick reference cheat sheet for Linux & Mac.

nano is the editor you meet when a server has nothing else installed, and its shortcuts are printed along the bottom of the screen — the caret means Ctrl and M- means Alt (Meta). The table expands those into full key names. Recent nano versions added the Ctrl + S and undo bindings that people used to complain were missing, so the rows below assume nano 4.0 or later, which every current distribution ships.

File Handling (5)

ShortcutAction
Ctrl + SSave File
Ctrl + OSave As
Ctrl + RInsert File
Ctrl + XExit
Ctrl + GDisplay Help

Editing (7)

ShortcutAction
Ctrl + KCut Line
Alt + 6Copy Line
Ctrl + UPaste
Ctrl + ]Complete Word
Alt + 3Comment Line
Alt + UUndo
Alt + ERedo

Deletion (5)

ShortcutAction
Ctrl + HDelete Character Left
Ctrl + DDelete Character
Alt + BackspaceDelete Word Left
Ctrl + DeleteDelete Word Right
Alt + DeleteDelete Line

Search & Replace (5)

ShortcutAction
Ctrl + FSearch Forward
Ctrl + BSearch Backward
Alt + FFind Next Forward
Alt + BFind Next Backward
Alt + RReplace

Operations (12)

ShortcutAction
Ctrl + TExecute Command
Ctrl + T, Ctrl + SSpell Check
Ctrl + T, Ctrl + YSyntax Check
Ctrl + T, Ctrl + ORun Formatter
TabIndent Region
Shift + TabUnindent Region
Ctrl + JJustify Paragraph
Alt + JJustify Buffer
Alt + TCut to End of Buffer
Alt + VVerbatim Input
Alt + :Record Macro
Alt + ;Replay Macro

Moving Around (14)

ShortcutAction
Ctrl + LeftWord Backward
Ctrl + RightWord Forward
Ctrl + AStart of Line
Ctrl + EEnd of Line
Ctrl + PLine Up
Ctrl + NLine Down
Ctrl + UpPrevious Block
Ctrl + DownNext Block
Alt + HomeFirst Row in View
Alt + EndLast Row in View
Ctrl + YPage Up
Ctrl + VPage Down
Alt + \Top of Buffer
Alt + /End of Buffer

Special Movement (9)

ShortcutAction
Alt + GGo to Line
Alt + ]Matching Bracket
Alt + <Scroll Left
Alt + >Scroll Right
Alt + UpScroll Viewport Up
Alt + DownScroll Viewport Down
Ctrl + LCenter Line
Alt + LeftPrevious Buffer
Alt + RightNext Buffer

Information (2)

ShortcutAction
Ctrl + CReport Cursor Position
Alt + DReport Counts

Toggles (7)

ShortcutAction
Alt + ASet Mark
Alt + CConstant Position Info
Alt + NLine Numbers
Alt + PVisible Whitespace
Alt + SSoft Wrapping
Alt + XHide Help Lines
Alt + ZHide Info Bars
📄 View Printable Cheat Sheet — Download as PDF or print · 🧩 Combine with other tools

Related Shortcut Pages

Vim Emacs Bash / Shell tmux Linux Helix Editor

Search 18,500+ shortcuts across 268 platforms

Explore All Platforms Practice Shortcuts
📜 Every shortcut on this page is taken from the official Nano documentation — nano-editor.org
🔧 Spotted an error or a missing shortcut? Suggest an edit on GitHub — every accepted fix goes live on this page, the API and the CLI.

Save, exit, and the prompt that confuses everyone

Ctrl + S saves in place and Ctrl + X exits, offering to save if the buffer changed — answer Y, then confirm the file name with Enter. Ctrl + O is "write out", the older save-as flow that prompts for a name each time. If you are stuck at a prompt, Ctrl + C cancels it; in the main editor the same key reports the cursor position instead. Ctrl + G opens the help screen, which lists every binding for the installed version.

Cut, copy and paste are lines, not selections

Ctrl + K cuts the current line into the cut buffer and Ctrl + U pastes it; pressing Ctrl + K on consecutive lines accumulates them, so cut-five-lines-and-move-them is five presses and one paste. Alt + 6 copies a line without removing it. To act on a region instead of whole lines, set a mark with Alt + A, move the cursor to extend the selection, then cut or copy. Alt + U undoes and Alt + E redoes.

Moving and searching

Ctrl + A and Ctrl + E go to line start and end, Ctrl + Left and Ctrl + Right move by word, and Ctrl + Y and Ctrl + V page up and down — assignments that look random until you notice they avoid keys the terminal reserves. Alt + G goes to a line number and Alt + \ and Alt + / jump to the top and bottom of the file. Ctrl + F searches forward (older builds used Ctrl + W), and Alt + R opens search-and-replace with a confirmation for each match.

Useful toggles

Alt + N shows line numbers, Alt + S soft-wraps long lines so they are readable without horizontal scrolling, and Alt + P shows whitespace, which is how you find the tab-versus-spaces problem in a YAML file. Alt + 3 comments or uncomments the current line using the syntax's comment character. These can be made permanent in ~/.nanorc.

Frequently asked questions

What do ^ and M- mean at the bottom of the screen?

^ is Ctrl and M- is Alt (Meta). ^X means Ctrl + X; M-U means Alt + U.

How do I select text in nano?

Press Alt + A to set a mark, move the cursor to extend the selection, then Ctrl + K to cut or Alt + 6 to copy it.

Why does Ctrl + S not save on my server?

Ctrl + S was added in nano 4.0. On older versions use Ctrl + O then Enter, and make sure the terminal is not treating Ctrl + S as flow control.

How do I go to a specific line?

Alt + G, then type the line number and press Enter. You can also start nano with +N filename to open at line N.

🤖 Ask AI about Nano shortcuts

Open your assistant with this page preloaded as the source — great for follow-up questions like "which of these work in other apps?"

ChatGPT Claude Perplexity Gemini Grok