How to Save and Exit a File in Nano [macOS/Linux/Ubuntu] Terminal


Article Readability: Easy | Reading time: 30 seconds

If you have edited a file by opening it using Nano Editor on your Terminal and want to save and exit the file, then you should follow the below steps.

  • Step 1: Press Control + X to enter EXIT mode."

    Press Keys Control + X to Exit Nano
  • Step 2: You will see a message at the bottom of the editor "Save modified buffer?

    Save modified buffer Nano Editor

    Press Y to Save and Exit the file, or press N to exit without saving the changes.


The example is demonstrated on GNU Nano version 7.2 on macOS Sonoma, but should work on all platforms Linux/Ubuntu/Bash.

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap