GNU Nano Keyboard Shortcuts

Gnu Nano Cheatsheet 00 Featured Image

GNU Nano is a lightweight yet powerful text editor for Linux, and it comes bundled in most distributions. Unlike Emacs and Vim, GNU Nano offers its users a straightforward way to quickly edit text files in the command line. This can be especially helpful if you secure a server with only an SSH terminal.

GNU Nano Keyboard Shortcuts Download

Download this Cheatsheet

Enter your email below to receive this PDF cheatsheet in your Inbox.

Essential GNU Nano Keybindings

By default, GNU Nano has a good set of keyboard shortcuts and commands you can use as soon as you load the text editor. However, one issue with this is that there is no clear way to access these shortcuts from the editor.

Knowing that, this cheatsheet gives you all the necessary keybindings for GNU Nano. Not only that, it also highlights some of the program’s little-known features.

CommandFunction
Buffer Movement
Ctrl + BMove the cursor one character backward.
Ctrl + FMove the cursor one character forward.
Ctrl + PMove the cursor one line up.
Ctrl + NMove the cursor one line down.
Ctrl + YMove the cursor one page up.
Ctrl + VMove the cursor one page down.
Ctrl + Left ArrowMove the cursor one word backward.
Ctrl + Right ArrowMove the cursor one word forward.
Ctrl + Up ArrowMove the cursor to the previous block.
Ctrl + Down ArrowMove the cursor to the next block.
Ctrl + AGo to the beginning of the current line.
Ctrl + EGo to the end of the current line.
Alt + Backslash (\)Go to the top of the current buffer.
Alt + Slash (/)Go to the bottom of the current buffer.
Alt + Less-Than (<)Go to the previous buffer.
Alt + Greater-Than (>)Go to the next buffer.
Alt + Up ArrowMove the buffer one screen up.
Alt + Down ArrowMove the buffer one screen down.
Alt + GGo to a specific line in the buffer.
Alt + Right Square Bracket (])Move the cursor to the matching bracket in the buffer.
File Manipulation
Ctrl + ROpen an existing file and place it in the current buffer.
Ctrl + SSave the current buffer in an existing file.
Ctrl + OSave the current buffer as a different file.
Ctrl + XClose the current buffer and exit GNU Nano.
File Editing
Ctrl + MCreate a new line at the current cursor position.
Ctrl + KCut the current line and place it in the clipboard.
Alt + TCut from the current point until the end of the buffer.
Alt + 6Copy the current line and place it in the clipboard.
Ctrl + UPaste the clipboard in the current cursor position.
Ctrl + HDelete the character before the cursor.
Ctrl + DDelete the character beneath the cursor.
Alt + BackspaceDelete the word to the left of the cursor.
Ctrl + DeleteDelete the word to the right of the cursor.
Alt + DeleteDelete the current line.
Alt + UUndo the last change in the buffer.
Alt + ERedo the last undo in the buffer.
Ctrl + JJustify the text in the current cursor position.
Alt + JJustify the text in the entire buffer.
Alt + 3Comment on the currently selected lines in the buffer.
Alt + VEnter the next keystroke as-is in the display.
Ctrl + Right Square Bracket (])Toggle GNU Nano’s autocomplete feature.
Alt + ASwitch to Text Marking mode.
Alt + Left Curly Bracket ({)Indent the currently marked region.
Alt + Right Curly Bracket (})Remove the indent in the currently marked region.
Searching
Ctrl + WOpen the Search dialog box.
Ctrl + QOpen the Reverse Search dialog box.
Alt + WHighlight the next word that matches the search query.
Alt + QHighlight the previous word that matches the search query.
Alt + ROpen the Replace dialog box.
Interface Manipulation
Ctrl + GDisplay the Help screen.
Alt + NDisplay line numbers in the current buffer.
Alt + PDisplay all whitespace as printable characters.
Alt + XToggle the Help Lines in the current buffer.
Alt + BCheck for incorrect syntax in the entire buffer.
Alt + FFix the formatting in the current buffer.
Ctrl + TRun an external command on the current buffer.
Alt + Colon (:)Create and save a new macro.
Alt + Semicolon (;)Run a macro on the current buffer.
Ctrl + LReload the current GNU Nano display.
Alt + IToggle GNU Nano’s Auto Indent feature.
Alt + LToggle the text wrapping.
Alt + OConvert all typed tabs into spaces.
Alt + MEnable mouse support in GNU Nano.

Image credit: Unsplash. All alterations and screenshots by Ramces Red.

Is this post useful?
Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Ramces Red
Ramces Red - Staff Writer

Ramces is a technology writer that lived with computers all his life. A prolific reader and a student of Anthropology, he is an eccentric character that writes articles about Linux and anything *nix.