Nano Cheat Sheet [Free PDF Download]

LINUX
FUNDAMENTALS
A Complete Guide for Beginners Enroll Course Now

Nano, primarily associated with Unix-like operating systems, is a small, popular, and user-friendly text editor. This text editor is admired the most due to its simple and interactive approach. It offers versatile features to both beginners and experts. Here, I will demonstrate a cheat sheet with all the keyboard shortcuts of the Nano text editor. So, if you are aiming to explore this text editor, then this guide will be an amazing resource for you.

Download Nano Cheat Sheet

Nano cheat sheet image

Available Download Options


Most Popular

PDF (3 Pages)

DOC (3 Pages)

Combo Pack

ZIP (pdf, docx, png)

Nano Cheat Sheet

In the Nano text editor, you can use numerous keyboard shortcuts for every task and operation. This improves one’s productivity and functionality. A comprehensive list of essential keystrokes of the Nano text editor is listed below:

Getting Started Nano Cheat Sheet

You can learn how to launch and exit a Nano text editor using the following keystrokes:

Type nano to enter Nano text editor
Shortcut Keys Description
CTRL + Z Suspend Nano
CTRL + X Exit Nano permanently

Navigation in Nano

Using various keyboard commands you can navigate through any document you want. Here are some navigation keystrokes in Nano:

Shortcut Keys Description
ARROWS (↑, ↓, ←, →) Move the cursor up, down, left, or right
CTRL + P Move the cursor up one line
CTRL + N Move the cursor down one line
CTRL + B Move the cursor left one character
CTRL + F Move the cursor right one character
ALT + F or CTRL + → Move forward by one word
ALT + B or CTRL + ←  Move backward by one word
CTRL + V Scroll page down
CTRL + Y  Scroll half a page up
CTRL + W Scroll a full page up
CTRL + A Go to beginning of the line
CTRL + E Go to end of the line
ALT + < Go to beginning of the file
ALT + > Go to end of the file
CTRL + _ Go to a specific line
ALT + , Jump to a specific line or column
CTRL + ↑ To previous block
CTRL + ↓ To next block
ALT + \ To top of buffer
ALT + / To bottom of buffer

Case Conversion in Nano

Case conversion on lines or selected text can be performed with the help of some keyboard commands available in Nano.

Shortcut Keys Description
ALT + L Convert the selected text to lowercase
ALT + U Convert the selected text to uppercase
ALT + C Capitalize the selected text or the current word

File Handling Keys in Nano

Use the following Nano shortcuts to manipulate and handle files comprehensively:

Shortcut Keys Description
CTRL + S Save current file
CTRL + O Offer to write file (“Save as”)
CTRL + R Insert a file into current one
CTRL + A Append the contents of another file to the current file
CTRL + W Write the current file to a different filename
CTRL + T Invoke the spell checker on the current file

Editing Shortcuts in Nano

Editing means modifying or manipulating particular text by inserting, marking, highlighting, cutting, copying etc. Here are some common key combinations for editing in Nano:

Shortcut Keys Description
CTRL + K    Cut current line into cutbuffer
ALT + 6 Copy current line into cutbuffer
CTRL + U Paste contents of cutbuffer
ALT + T Cut until end of buffer
CTRL + SPACE Set a mark at the current position
CTRL + ] indent the current line
ALT + ] Unindent the current line
ALT + 3 Comment/uncomment line/region
ALT + U Undo last action
ALT + E Redo last undone action

Getting Help in Nano

You can access the built-in documentation of Nano and explore its features using the shortcuts below:

Shortcut Keys Description
CTRL + G Show the help menu
CTRL + G + ? Get help on using the help viewer
CTRL + G + B Basic movement commands
CTRL + G + C Commonly used commands
CTRL + G + S Search and replace
CTRL + G + P Nano’s preferences
Q Quit the help buffer

Regex in Nano

Basically, Nano supports the POSIX Regex (Regular Expression). Some key points to remember while using regex in Nano: 

Shortcut Keys Description
. Matches any single character except a newline
^ Matches the start of a line
$ Matches the end of a line
* Matches zero or more occurrences of the preceding character or group
+ Matches one or more occurrences of the preceding character or group
? Matches zero or one occurrence of the preceding character or group
{n} Matches exactly n occurrences of the preceding character or group
{n,} Matches at least n occurrences of the preceding character or group
{n,m} Matches between n and m occurrences of the preceding character or group
[abc] Matches any single character in the given set (a, b, or c)
[^abc] Matches any single character not in the given set (not a, b, or c)
(abc) Creates a group that can be referenced or repeated
\ Escapes a special character or treats it literally
| Acts as an OR operator, matches either the expression before or after it

Operations in Nano

Nano offers multiple operations to manipulate and justify files. Shortcuts of these operations are given below:

Shortcut Keys Description
CTRL + T Execute some command
CTRL + J Justify paragraph or region
ALT + J Justify the entire buffer
ALT + F Run a formatter or fixer
ALT + B Run a syntax check
ALT + ; Replay macro
ALT + : Start/stop recording of macro
ALT + N Turn line numbers on/off
ALT + P Turn visible whitespace on/off
CTRL + L Refresh the screen and redraw the interface
CTRL + W Switch between smooth scrolling and line scrolling

Search Shortcuts in Nano

To search for specific patterns or words, Nano has various search keybindings. Here is how you can perform your search operation in Nano with the keys:

Shortcut Keys Description
CTRL + W Start forward search
CTRL + Q Start backward search
ALT + W Repeat the last forward search 
ALT + Q Find next occurrence backward
ALT + R Repeat the last backward search
ALT + W + CTRL + W Toggle case sensitivity during search
ALT + W + ALT + W Toggle whole word search during search
ALT + W + ALT + R Toggle regular expression search during search
CTRL + W + CTRL + W Move to the next occurrence of the search pattern
CTRL + W + CTRL + V Move to the previous occurrence of search pattern
ALT + W + ALT + V Move to the next occurrence of the search pattern (ignoring case)
ALT + W + ALT + B Move to the previous occurrence of the search pattern (ignoring case)
CTRL + W + CTRL + L Toggle the “Search backwards” option during search
CTRL + W + CTRL + O Toggle the “Wrap around” option during search
CTRL + W + CTRL + C Count the number of occurrences of the search pattern
CTRL + W + CTRL + G Cancel the search and return to editing

Replace Keystrokes in Nano

To replace any text or pattern in the Nano text editor use the keybindings below:

Shortcut Keys Description
CTRL + W + CTRL + T Replace the current occurrence of the search pattern
CTRL + W + CTRL + + Replace all occurrences of the search pattern
CTRL + W + CTRL + A Replace all occurrences of the search pattern interactively
CTRL + W + CTRL + I Interactive replace with confirmation for each occurrence

Deleting in Nano

For deleting unwanted terms in Nano, try out the shortcuts below:

Shortcut Keys Description
CTRL + H Delete character before cursor 
CTRL + D Delete character under cursor 
ALT + BSP Delete word to the left
CTRL + DEL Delete word to the right
ALT + DEL Delete current line

Info Shortcuts in Nano

Info is the built-in documentation that provides important information regarding Nano. Follow the keystrokes below to get info in Nano:

Shortcut Keys Description
CTRL + C Report cursor position
ALT + D Report line/word/character count
CTRL + G Display help text

Marking Keystrokes in Nano

To utilize marking and manipulating a bunch of texts in Nano, go with the keyboard shortcuts below:

Shortcut Keys Description
CTRL + ^ or CTRL + 6 Set the mark at the current cursor position
ALT + A Turn the mark on/off
TAB Indent marked region
SHIFT + TAB Unindent marked region

Buffers in Nano

Buffers enable working capability with multiple files. Here is how you can carry out buffer keystrokes in Nano:

Shortcut Keys Description
CTRL + O Save the current buffer
CTRL + X Exit nano and close the current buffer 
CTRL + T Invoke the spell checker on the current buffer
CTRL + R Read a file into the current buffer
ALT + CTRL + P Switch to the previous buffer
ALT + CTRL + N Switch to the next buffer
ALT + CTRL + L List and select a buffer to switch to

Conclusion

Nano is the most commonly used text editor. The easy interface and keystrokes of Nano make users more forward to this. Going through the whole article on the Nano cheat sheet, you can clear your concept regarding Nano keyboard shortcuts in detail.

People Also Ask

What is Nano?

Nano is an easy-to-use, command-line-based text editor designed for Unix-like systems. Nano is commonly used in terminal environments to edit text quickly.

How do I open a file with Nano?

To open a file with nano, you can use nano filename syntax. Just replace the filename with the name of the file that you want to open.

How do I undo changes in Nano?

Nano does not have a built-in undo function. It is possible to revert changes manually or to manage versions using external tools.

How to delete or cut whole line in Nano?

To delete or cut a whole line in Nano, move the cursor to the beginning of the line you want to delete and press CTRL+K. This will cut or delete the entire line from the cursor position.

How to copy and paste text in Nano?

To copy text in nano text editor, press CTRL+6 to mark the starting of the text, then move the cursor using the arrow keys to select the text. Now press ALT+6 to copy the selected text. Now, to paste the selected text in nano, go to the point where you want to paste the text and then press CTRL+U.

How to save files and exit from Nano?

To save files in nano, press CTRL+O and Enter. And press CTRL+X to exit from nano.

5/5 - (1 vote)
Nadiba Rahman

Hello, This is Nadiba Rahman, currently working as a Linux Content Developer Executive at SOFTEKO. I have completed my graduation with a bachelor’s degree in Electronics & Telecommunication Engineering from Rajshahi University of Engineering & Technology (RUET).I am quite passionate about crafting. I really adore exploring and learning new things which always helps me to think transparently. And this curiosity led me to pursue knowledge about Linux. My goal is to portray Linux-based practical problems and share them with you. Read Full Bio

Leave a Comment