2

When ever I save a gedit file in a directory, two copies of it get saved with identical content. Ex: If the gedit file is named as file_name and saved in Home directory then when u ls the Home directory you get file_name and file_name~ in the list. When the file command is run against them I get ASCII text, with very long lines for both of them when I view their contents using the less command they seem to largely contain identical content. The ~ file is a copy of the file when it was saved for the penultimate time. Can someone please help me in understanding as to why such a file (the file with a trailing ~ mark in its name ) is created?

2

These are backup files that gedit creates by default. You can disable this feature by going to

Preferences → Editor

and unchecking the line

Create a backup copy of files before saving

  • but even after saving a what is the purpose of creating its backup in the same folder? – spaceman_spiff Aug 16 '14 at 1:33
  • 1
    The file with the ~ at the end is the backup. It is the previous version of the file that you just saved. You can try this out by making a file called test.txt. Put the line "this is a test" and save it. Then open the file in gedit and add another line "This is another test" and save it. Then look at the file with the tilda. It will just have the original line. – chthonous Aug 16 '14 at 1:37
  • ok u mean to say that this ~ version is the last saved copy...Thanx cleared my doubts although i still dont get the purpose of this procedure....say u have a saved version of a file...it means it has been written into the disc....then what is the purpose of saving the last saved version?......to add to that what is the purpose of saving it in the same directory? I can speculate about some weird situations like say what if accidentally i selec all press del and save it,then may be it is useful,but these chances are so rare aren't they? So is this feature worth it?Thanx for the detailed example – spaceman_spiff Aug 16 '14 at 8:36
  • I have edited the question accordingly – spaceman_spiff Aug 16 '14 at 8:40
  • Yeah. I've never found the feature too useful and don't like the extra files messing up my directories. I usually turn it off. I guess it is just personal preference at that point. – chthonous Aug 16 '14 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.