What does the tilde (~) mean at the end of a filename?

What is the file with the ~ at the end of the filename for?

$ ls # aliased to add flags
-rwxrwxr-x  1 durrantm  2741 May 16 09:28 strip_out_rspec_prep_cmds.sh~*
drwxrwxr-x 13 durrantm  4096 May 16 14:21 ../
-rwxrwxr-x  1 durrantm  2221 May 16 14:58 strip_out_rspec_prep_cmds.sh*

This is not the same as .swp files which are there while editing.

The two files have quite a few differences and the newer file (no ~ at the end) has the most recent changes and those changes are not in the older (~) file.

Looks like I can delete it?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Typically files ending with a ~ are backups created by editors like emacs, nano or vi.

Method 2

A tilde suffix is usually used for backup files. Vim and Emacs use this convention and probably many other programs, too. .swp files are vim swap files which are only present during editing of a file or in the case vim crashed.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x