When working with the Linux terminal, it is obvious to use nano text editor for creating, and editing text files or configuration files. Nano is the default text editor that comes with the default installation of Ubuntu 22.04. It provides the basic functionality of editing and creating text files. It has a simple user environment, which is very easy to use.
In this article, we will see, how you can save files and exit the nano editor.
How to Save and Exit Nano Editor?
It becomes very difficult for a new user to save a file when it comes to a command line text editor like Nano. Because there is no save GUI option available in the nano text editor. Let’s follow the instructions given below if you find it difficult to save files and exit the nano text editor.
Launch the Terminal
Press the “Ctrl + Alt + t” keys to launch the terminal. Then write the following command to open the file in the nano text editor:
$ nano file01.py
The command will open the file01.py file in the nano text editor:
Now you can write your desired text/code in this file:
If you want to save the changes, press “Ctrl + O” OR “Ctrl + s” and hit the “Enter” key, At the bottom of the window you will see the number of lines you have written and saved:
Now if you want to exit from the nano text editor, press “Ctrl + x”, and the nano text editor window will be closed, and you’ll return to the terminal window.
This is how you can save files and exit from the nano text editor.
Conclusion
To save the files in the nano text editor, press the “Ctrl + s” or “Ctrl + O”, and to exit from the nano text editor, press “Ctrl + x”. In this article, we have explained how you can save and exit the nano text editor.