If you are looking at file listings (ls) in Terminal on your Linux system, you may have seen duplicate files that end with a tilde (~). Such as having two files, notes.txt and notes.txt~, in the same directory.
I have found these to be quite annoying and have to manually remove them before I package up the files. I also didn’t know exactly where they came from until today.
I use Gedit to work on text files. It just so happens that every file that has a tilde duplicate was modified by Gedit. These files are automatic backups that are created before you save a modified file using Gedit.
To prevent Gedit from creating these backups in the future, open up Gedit, open up the Preferences dialog (Edit > Preferences), select the Editor tab, remove the check in the “Create a backup copy of files before saving” option, and click Close. After doing this, Gedit will no longer make the backups with tildes all over the place.
Did I help you?
Thank you very much for solving my problem! I’m a unix newbie and was thinking that maybe unix was responsible for these “implicit” files with the tilde. Obviously not though.
I’m glad that I could help Bryce.
ls -B lists files in a directory, omitting files whose names end with a tilde.
If you use ll, I suggest adding the -B option only to ll alias in your .bashrc file, so that you can use ls to find the backup files, should you ever need them. The tilde files are aesthetically annoying, but unless you are perfect you might want to think twice before disabling backup creation in whatever text editor you are using.
From my .bashrc file:
alias ls=’ls –color=auto –group-directories-first’
alias ll=’ls -l -B’
That’s helpful information adkein. Thanks for sharing it.
The reason I wanted to remove them isn’t because I didn’t like looking at them; rather, it is because I release projects for work. Having a ton of duplicate files with tildes at the end would surely confuse people if they leaked out into the releases.
Little late but this might help someone…
If you want to delete all the backup files created for packaging or what not then this command is most useful:
find . -name “*~” -exec rm -rf {} \;
This will delete all files ending in a tilde in the current directory and all subdirectories recursively. Use at your own risk!
Thanks a lot!
No more
rm *~
Thank you for this.
~ files were annoying as hell when I work with git.
Thank You Chris. I got rid of those annoying files and now I have a cleaner directory.
Thank you so much!
thank u so much friend
thank you!
Thank you so much~! Annoyed me for a long time.
Thanks,
Really helpful!!