I have a problem with the Nano
editor. If it ever exits unexpectedly, it leaves behind .save
files, which are just versions of the edits I was making. Is there a way to disable this behaviour?
2 Answers
From Nano's man
In some cases nano will try to dump the buffer into an emergency file. This will happen mainly if nano receives a SIGHUP or SIGTERM or runs out of memory. It will write the buffer into a file named nano.save if the buffer didn’t have a name already, or will add a ".save" suffix to the current filename. If an emergency file with that name already exists in the current directory, it will add ".save" plus a number (e.g. ".save.1") to the current filename in order to make it unique. In multibuffer mode, nano will write all the open buffers to their respective emergency files.
So, it is a nano emergency file where its buffer gets dumped. The flag −F (−−multibuffer) would enable multiple file buffers, if available. The flag −R (−−restricted) or restricted mode, will guide Nano to not read or write to any file not specified on the command line; read any nanorc files; allow suspending; allow a file to be appended to, prepended to, or saved under a different name if it already has one; or use backup files or spell checking. Also accessible by invoking nano with any name beginning with ’r’ (e.g. "rnano").
-
-
Dear @Levi H. yes, per the response bove, use
nano -R
when you call it from terminal– user88036Sep 21, 2018 at 10:46 -
1that won't work, I asked if I could use it without the other limitations you posted above...– Levi HSep 24, 2018 at 11:07
The -R
/ --restricted
option will disable saves (as well as some other features):
Restricted mode: don't read or write to any file not specified on the command line; read any nanorc files; allow suspending; allow a file to be appended to, prepended to, or saved under a different name if it already has one; or use backup files or spell checking. Also accessible by invoking nano with any name beginning with 'r' (e.g. "rnano")