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.

Ramces Red Avatar

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Read next

If you double-check if the door is locked (even when you know it is), psychology says you likely have these 8 distinct traits
Psychology says people who push their chair back in when they leave a table usually display these 9 unique behaviors
Mycorrhizal fungi colonised plant roots roughly 450 million years ago and biologists now suspect plants could never have moved out of the oceans onto bare rock without them, meaning every forest on Earth — including the redwoods, the Amazon, and the boreal belt — is still running on a partnership older than trees themselves
Suzanne Simard sealed paper birch and Douglas fir seedlings inside plastic bags, fed them carbon-14 and carbon-13 dioxide, and nine days later found carbon had crossed between species through fungal threads in the British Columbia soil beneath her boots
A species of jellyfish called Turritopsis dohrnii can revert its adult cells back to a juvenile polyp stage when injured or starving, effectively restarting its life cycle, and biologists have so far failed to identify any natural limit to how many times it can do this.
French scientist Michel Siffre spent two months alone in a cave with no clock, no calendar, and no sunlight — and when his team finally told him the experiment was over, he thought he still had nearly a month left underground
When Cingular chief Stan Sigman backed the original iPhone before its 2007 unveiling, he accepted terms American carriers usually refused: no logo on the device, no control over its software, no preloaded apps, and a share of monthly subscriber revenue flowing back to Apple, after signing on without seeing a prototype
In 2016, archaeologists dated two rings of snapped stalagmites in France’s Bruniquel Cave to 176,500 years ago, evidence that Neanderthals had walked 336 metres into darkness with fire and built architecture deep underground long before modern humans reached Europe