Introduction to Nano Editor

Using Nano Editor

Save and Exit From the Nano Text Editor

Done editing your text file? Learn to save and exit Nano.

So you've made some changes or created a new file, wrote some lines and now you want to save them and want to exit from the nano text editor. Right?

Well, all you have to do is follow two simple steps:

  • Press Ctrl + O and then press the Enter key to save changes
  • Press Ctrl + X to exit from the nano text editor

Yep, it's that simple.

Want to learn every step in detail? I got you!

Save changes in nano (without exiting it)

After making a huge change or the file you may want to save those changes for various reasons.

In that case, you can refer to this section where I will walk you through how you can save changes and continue making further changes.

While making changes, you will see * symbol to the file name indicating you've made changes that are yet to be saved:

nano indicating chanegs are yet to be saved

If you see the same, you need to save the changes.

To save changes, press the Ctrl + O and it will ask you to verify the filename to write changes to. There you can change the filename and save it to a different filename.

Verify the filename and press the Enter to save changes:

Save changes in the nano text editor

Once you save the changes, it will show you the number of lines that saved in that specific file:

nano text editor showing number of the lines stored inside of file

From here, you can continue editing the file or close the text editor (I'm about to show you how to).

Exit from the nano text editor

Once you are done saving the changes, you can exit from the nano text editor by pressing the Ctrl + X shortcut.

But what if you forgot to save changes?

Don't worry. If you forgot to save changes, it will ask you if you want to close the editor by saving changes or not.

If you want to save changes, then press Y and it will show you the filename (repeats the same process that I explained to save changes):

Save changes before closing the nano text editor

If you don't want to save changes and want to exit from the text editor, then press N and it will get the job done.

Want to learn Nano? I got you!

If you are a beginner and want to learn all the basics of the Nano text editor then I have good news for you.

We made a detailed beginner guide to the nano text editor:

Editing Files With Nano in Linux [With Cheat Sheet]
Though Nano is less complicated to use than Vim and Emacs, it doesn’t mean Nano cannot be overwhelming. Learn how to use the Nano text editor.

I hope you will find this guide helpful.