Close/Exit the Nano Editor on Ubuntu
How do you close/exit the nano editor on Ubuntu?
Use this keyboard shortcut:
CTRL + x
If you've made unsaved changes to your file, you'll be asked if you want to save the changes.
These are your options:
- Save your changes by pressing
y
(for "yes"). - Discard your changes by pressing
n
(for "no"). This will close nano without saving your changes. - Cancel your request to close nano by pressing
CTRL
+x
. This removes the prompt without closing nano or saving/discarding your changes.
If you saved your changes, you'll also be prompted for a file name to write to. This tells nano where to save your changes.
Press ENTER
to write the changes to the already existing file you were making updates to and close/exit nano.
Thanks for reading and happy coding!