How to exit the GNU nano editor?
Just press Ctrl+X
. If you dont have unsaved changes, this will exit nano immediately.
In case you have unsaved changes, it will ask you whether to save those changes after pressing.
- Press
Y
to tell it to save the changes you’ve made. It will then ask you to check or enter the filename to save to. Once you are finished with the filename, press Enter. - Press
N
to discard all changes **(you won’t be able to restore your changes later)**and exit nano immediately.