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

When you tilt a smartphone, gravity shifts microscopic silicon fingers inside its accelerometer by only a few nanometres, changing the capacitance between them and producing the electrical imbalance the phone reads as a new direction for down
Content and cloud networks now account for three-quarters of used international bandwidth, while Google, Meta, Microsoft and Amazon own, co-own or buy capacity on a growing share of the 600-plus submarine cable systems carrying over 99 per cent of data between countries, a private map hidden below the wireless internet
The peak of Chimborazo in Ecuador sits about 2,072 metres closer to space than Everest’s summit — because Earth bulges at the equator, and Chimborazo stands almost directly on the bulge
Wi-Fi doesn’t actually slow down when a café gets crowded — the signal is fine, but every device has to wait its turn to speak on the same frequency, and the polite queuing is what you feel as lag
People who are truly pleasant and kind but have no close friends often spent decades being the one everyone called during a crisis — and somewhere along the way noticed almost none of those calls had reversed direction
Research suggests the feeling that time speeds up with age can be shaped by fewer temporal landmarks — the small disruptions to routine that give the brain something worth remembering
Ray-finned fishes evolved bioluminescence at least 27 chemistry and others by housing luminous bacteria, a repeated evolutionary experiment spread across deep-sea, inshore and reef lineages using different molecular machinery to make visible light
The Sun is actually white — the yellow we see is Earth’s atmosphere scattering the shorter blue wavelengths away before the light reaches our eyes, which is also why sunsets turn red