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 my_file.sh 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.