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

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
Otto von Bismarck was 74 when Germany adopted the world’s first national old-age social insurance program in 1889, setting the pension age at 70 after years of fighting socialists with bans, laws, and a promise few workers would live long enough to use
When cosmonaut Valeri Polyakov stepped out of his Soyuz capsule in March 1995 after 437 consecutive days aboard Mir, doctors recorded him at several centimetres above his pre-flight height, and his spine had become so unaccustomed to gravity that the recovery team carried him to a chair rather than risk the compression of letting him walk.
When Harvard astronomer Cecilia Payne submitted her 1925 doctoral thesis arguing that the Sun was made almost entirely of hydrogen, the field’s senior figure Henry Norris Russell talked her into adding a line calling the result ‘almost certainly not real,’ and then published the same conclusion himself four years later to widespread acclaim.
When Edme Mariotte stared at marks on a wall in the 1660s, one mark vanished inside a six-degree hole where the optic nerve leaves the eye and the brain has been filling in wallpaper, sky, and faces ever since
When seismic waves from the Chicxulub impact reached what is now North Dakota roughly ten minutes after the asteroid struck, they appear to have triggered a ten-metre standing wave in an inland river that flung fish onto the bank and buried them under glass beads still falling from the sky.
When survivors near Lake Nyos woke on the morning of 22 August 1986, the cattle were dead in the fields, the birds had fallen out of the trees, and 1,746 of their neighbours were lying where they had stood the night before, with no fire, no flood, and no wound to explain it.
In 1959, a Soviet research team in Novosibirsk began breeding silver foxes for nothing but tameness, and within forty generations the animals had floppy ears, curled tails, piebald coats, and a bark, traits no one had selected for but which appeared on their own once fear was removed.