Nano is a free and open-source popular command line text editor. It comes with syntax coloring, auto-indentation, word completion, file locking, line numbers, and many more. For first-time users, saving a file in keyboard based Nano is a little confusing task. So, in this tutorial, we will see how to save a file in the nano editor in a Linux system.
Save and Exit a File using Nano
You can open any file in Nano using below command.
nano your-file-name
Just replace “your-file-name” with a real file name and path.
Example:
nano .bashrc
[OR]
nano ~/.bashrc
After the editing, use the following instructions to save the file and exit nano text editor.
Now press Ctrl + X on your keyboard. This will attempt to exit nano.
Now enter Y and hit the enter key
Now you will be asked to give a name to the file. Simply hit the Enter key on your keyboard. If you want to rename the file, then fill out a new file name and enter.
That’s all.