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.

Comments & Discussion

Facing issues? Have questions? Post them here! We're happy to help!