What is GNU Nano Editor on Linux

Linux TLDR
Last Updated:
Reading time: 2 minutes

GNU nano is a built-in text editor for major Linux distributions, providing similar options to edit and modify files as its competitors VIM and Emacs.

Although, its competitors are way more advanced in count of features and functionalities. However, many users still prefer to use Nano as their default text editor.

Tutorial Details

DescriptionGNU Nano Editor
Difficulty LevelLow
Root or Sudo PrivilegesMaybe
OS CompatibilityUbuntu, Manjaro, Fedora, etc.
Internet RequiredNo

Opening the Nano Editor

To open a nano editor simply execute the following command with or without specifying the file.

$ nano

Getting Started

You will interact with the following window when you open the Nano editor.

GNU nano editor in Linux

Now you can type your content inside this file and use the β€œCtrl+x” keyboard shortcut to save the file.

While processing, it will ask to save the modified buffer. Input β€œy” for yes.

Save modified buffer

At last, it will ask you to specify the file name; type your filename with the extension and press the β€œenter” key.

Naming the new file in nano editor

In future if you want to open the same file than specify the path of this file to the β€œnano” command as shown.

$ nano file.txt


Opening the save text file in nano editor

If you modify this saved file, after typing your first new content inside this file, you will get β€œ*” in front of the file name.

Modifying the saved file in nano editor

A lot of things you can do with nano editor by using the keyboard shortcut mentioned below.

Keyboard Shortcuts

File handling

Ctrl+SSave current file
Ctrl+OOffer to write file (β€œSave as”)
Ctrl+RInsert a file into current one
Ctrl+XClose buffer, exit from nano


Ctrl+KCut current line into cutbuffer
Alt+6Copy current line into cutbuffer
Ctrl+UPaste contents of cutbuffer
Alt+TCut until end of buffer
Ctrl+]Complete current word
Alt+3Comment/uncomment line/region
Alt+UUndo last action
Alt+ERedo last undone action

Search and replace

Ctrl+QStart backward search
Ctrl+WStart forward search
Alt+QFind next occurrence backward
Alt+WFind next occurrence forward
Alt+RStart a replacing session


Ctrl+HDelete character before cursor Β Β Β Β Β 
Ctrl+DDelete character under cursor
Alt+BspDelete word to the left
Ctrl+DelDelete word to the right
Alt+DelDelete current line

Moving around

Ctrl+BOne character backward
Ctrl+FOne character forward
Ctrl+←One word backward
Ctrl+β†’One word forward
Ctrl+ATo start of line
Ctrl+ETo end of line
Ctrl+POne line up
Ctrl+NOne line down
Ctrl+↑To previous block
Ctrl+↓To next block
Ctrl+YOne page up
Ctrl+VOne page down
Alt+\To top of buffer
Alt+/To end of buffer

Special movement

Alt+GGo to the specified line
Alt+]Go to the complementary bracket
Alt+↑Scroll the viewport up
Alt+↓Scroll the viewport down
Alt+<Switch to preceding buffer
Alt+>Switch to the succeeding buffer


Ctrl+TExecute some command
Ctrl+JJustify paragraph or region
Alt+JJustify entire buffer
Alt+BRun a syntax check
Alt+FRun a formatter/fixer/arranger
Alt+:Start/stop recording of macro
Alt+;Replay macro


Ctrl+CReport cursor position
Alt+DReport line/word/character count
Ctrl+GDisplay help text


Alt+ATurn the mark on or off
TabIndent marked region
Shift+TabUnindent marked region
Alt+VEnter next keystroke verbatim
Alt+NTurn line numbers on or off
Alt+PTurn visible whitespace on or off
Alt+XHide or unhide the help lines
Ctrl+LRefresh the screen

I hope you understand the usage of the nano editor; if you still have a doubt, do let us know in the comment section.

Join The Conversation

Users are always welcome to leave comments about the articles, whether they are questions, comments, constructive criticism, old information, or notices of typos. Please keep in mind that all comments are moderated according to our comment policy.