26

I have been writing several bash scripts, and I have found that while writing them that extra copies of the files have been created which seem to be identical in contents to the normal files, except their extensions are .save, what are these files, why do I need them, and can I delete them as they are just clogging everything up? They also seem to have the same permission levels set on them as the files that they seem to be copies of.

I am using nano as my editor.

αғsнιη
  • 35,660
  • Most likely, the editor you're using to edit saves them as backup and doesn't cleanup on close. – psukys Mar 27 '15 at 12:27
  • Note that this happen with many editors. Vim too does this as does kate (the extensions may differ). – Bakuriu Mar 27 '15 at 21:33

2 Answers2

27

It is a nano emergency file where its buffer gets dumped. If your current file seems alright, you can delete the filename.save associated file.

From nano manual notes:

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.

psukys
  • 3,590
  • In case the current file is not updated (for some reason, file was modified, not saved, .save was created, then poweroff of the system), but the .save file is updated, is it as simple as rm current.file and mv current.file.save current.file ? – M.K Oct 31 '22 at 10:20
5

Are you using the Nano text editor? If so, this two links might help

The save file extension is associated with the command line text editor Nano that is a part of various Unix and Unix-based operating systems. The *.save file contains temporary saved text file. It is backup used to protect text document against system crashes. After the text is saved by user the temporary save file can be deleted.
reference: www.file-extensions.org

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.
reference: nano manual

αғsнιη
  • 35,660
Zeku
  • 51