Prevent gedit from creating files with the '~' (tilde) suffix

Those are just backups of your original files that gedit creates before saving changes to your edited documents.

In gedit preferences you need to disable Create a backup copy of file before saving, and if you want to automatic save your edits automatically set a timer with the option enable Autosave files every X minutes.

That way the ~ will be gone and your last changes will be saved on the file every x minutes in case something goes bad or your computer crashes.

enter image description here

The changes made to the file will be saved to the file itself and not to a temporary file.

Please be aware that if you delete the contents of a file and auto save is enable there will be a chance that you end up with a saved empty file.

Always make sure that when you close on file while auto save is enabled that the contents of the file are correct, else undo them and save the file again.


GEDIT by default has an option enabled which creates a backup file (with the suffix ~ for the backup file) every 10 minutes. You can easily disable this default behavior.

Go in the gedit menu to Edit > Preferences > Editor, there you will find an option that says Create a backup of files before saving. Uncheck this option and you are done.

There is another option below that one called autosave files every .. minutes. I mention this one since some people like to have the backup option enabled but prefer to autosave less often, like 30 minutes or 1 hour as opposed to the default 10 minute interval.

In any case to disable the ~ (tilde) preceded file creation just disable (uncheck) the Create a backup of files before saving

A view of the Editor options in gedit:

screenshot of Editor options


You may be able to turn off these automatic backups by going into Edit > Preferences and unchecking the Create backup copies of files before saving option under the Editor tab:

Gedit preferences

Alternatively, you can use a terminal to navigate to the directory where you are saving your files and remove the backup files using rm *~.

Tags:

Gedit