How to exit nano and save to current file automatically?

Whenever I close nano after having edited an existing file, it first asks if I'd like to save the file (which is fine), and then asks me to confirm the filename (so I press Enter, since literally 100% of the time I want to keep the same filename).

So I'm wondering, is there any shortcut I can use to avoid having to confirm the filename every time?


Solution 1:

According to Nano manual

You can configure ~/.nanorc to Save automatically on exit, don't prompt

($:~)=> nano -w ~/.nanorc 

# Save automatically on exit, don't prompt 
set tempfile 

Note: as @cutrightjm commented - the above setting can cause major problems in configurations if you are not careful and modify files and auto-save on exit.