Linux Applications

How do I quit Nano?

Nano is a user-friendly text editor that provides an ease to the new users than other editors. Users can start work on Nano without getting any training. Nano text editor is not similar to the most popular vim editor. It doesn’t have fancy changing modes that have vim. It works on simple keyboard shortcut keys. So, just hold the Ctrl key and press any key with it to perform an action.

When you have launched a nano editor by typing the ‘Nano’ command on the terminal. You will see the following shortcuts at the bottom of the displaying nano window.

To quit nano ^X will be displayed on nano which is also highlighted in the following screenshot:

In the above image, the carrot ^ symbol in nano represents the use of the Ctrl key. If you are looking for how to exit or quit Nano then, you will press ‘Ctrl + x’ keys with the combination. While working on nano, you will press F2 or ^X means Ctrl + X to exit from the current buffer or quit nano. After that, you will be prompted to save the current file press ‘y’ and if you don’t want to make any changes then press ‘n’. You can also press Ctrl+o to save this file. Then, you need to enter the file name that you want to keep. You can also see this in the following screenshot:


Let’s take an example of how to quit or exit from nano. We are working on a bash file in nano. Suddenly, you want to close the nano editor due to any reason. To quit nano, you will just press F2 or Ctrl + X keys. You will be asked to press ‘y’ to save the current file, or in case of without saving you will press n to exit from nano.

About the author

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.