Quick Guide for nano Linux Text Editor

nano linux text editor

Nano Linux Text Editor is a popular alternative to the default vi text editor that is commonly pre-installed in most Linux distributions. Vi consists of a blank layout and no visible controls, which can be a big challenge to work with, for beginners. However, it is very powerful and once you learn the keystrokes, it can be used very quickly to edit config files and used for scripts. On the other hand, Nano has a pseudo-graphical layout that makes it a little easier to jump right into. Both are viable options but if there is an easier alternative to master, why not use the nano Linux Text Editor?

Installing Nano

Nano is not pre-installed in most Linux distributions. As such, you may wish to install Nano onto your Linux server first.

For AlmaLinux

The following command will install nano:

dnf install nano

For Ubuntu/Debian

Use the following command to install nano:

sudo apt-get install nano


Execute this command to install nano:

yum install nano

Using Nano

Now that you have installed Nano on your server, let’s master the use of Nano through some of these commonly used command and shortcuts:

Launching Nano

This is how to create a new file and edit with Nano:

nano new-filename

If you wish to create a new file within new directory and edit with Nano:

nano /path/to/new-directory/new-filename

Finally, to launch Nano and edit an existing file:

nano existing-filename

To save a file in Nano

Press Ctrl + O to save the changes and continue with using Nano

To save a file and exit Nano

Press Ctrl + X and then press Y and Enter to save and close Nano.

To use Nano

Navigate around using the arrow keys on your keyboard. You may highlight any words, sentence or paragraph using your mouse cursor (which will copy it). When you right-click on your mouse, it will paste whatever contents you’ve copied before, into Nano.

  • Press Ctrl + A to quickly jump to the beginning of the line.
  • Press Ctrl + E to jump to the end of the line.
  • Press Ctrl + Y to scroll down the page
  • Press Ctrl + V to scroll up the page
  • Press Ctrl + C to show the current text cursor position (in line/column/character counts)
  • Press Ctrl + _ to go to the specified line and column within the same file

To search for a text

Press Ctrl + W, insert the text you wish to search for and press Enter. To continue searching for the same text, press Alt + W.

To search & replace a text

Press Ctrl + W then Ctrl + R, insert the text you wish to search for and the text to replace it with. Press Y to replace one instance or A for all instances.


While the above command and shortcuts are not the extensive list within Nano Linux Text Editor, you will be able to use and master Nano text editor quickly if you are familiar with these basic ones. Nano text editor is our favourite choice for it is really simple and suitable for both beginners and experts!

Related Post