When I create a file using vim and save it, for eg. main.c, two copies are created: main.c and main.c~. They have the same contents. Why is this happening and what does the ~ mean?


This is just a convention to indicate a backup file.

| improve this answer | |
  • What should I do about it? I don't want a separate backup file to be present when I commit stuff using git. – ask Feb 3 '13 at 16:29
  • 2
    Create a .gitignore file and add *~ to it. – bash0r Feb 3 '13 at 16:39
  • You can also turn this off in vim - see the backup and writebackup options – Gereon Feb 3 '13 at 16:47

it is used to indicate the backup file. even in Microsoft office products when you open any file, same file is created with same name beginning with ~ but it is hidden.

| improve this answer | |

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.