What does a ~ mean after a file name in UNIX (bash)?

5,377

Solution 1

This is just a convention to indicate a backup file.

Solution 2

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.

Share:
5,377

Related videos on Youtube

ask
Author by

ask

Updated on September 18, 2022

Comments

  • ask
    ask over 1 year

    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?

  • Admin
    Admin over 11 years
    What should I do about it? I don't want a separate backup file to be present when I commit stuff using git.
  • Admin
    Admin over 11 years
    Create a .gitignore file and add *~ to it.
  • Admin
    Admin over 11 years
    You can also turn this off in vim - see the backup and writebackup options