The Files Having Their Names Ending With Tilde: What Are They And How To Remove Them?

In Gnome, gEdit creates some backup copies of edited files. This backups have the name of the original files, but with a tilde character added at the ending of the filename. After exiting gEdit, these files do dissapear.

From what I have noticed, gEdit creates a backup copy of a file when you open that file with gEdit, so if you save the modifications but, later, need the original file, you may find it as the filename appended by tilde: filename~ .

Do not rely on gEdit, and backup the important files yourself.

Also, the Emacs and Vim text editors have the same behaviour in automatically creating backup files, similar to gEdit.

To find the files having their filenames ending with tilde, use this find trick:

$ find . -type f -name '*~'

AND, delete all these files:

$ find . -type f -name '*~' -exec rm -f '{}' \;

To manually remove these files, escape the tilde in the filename, like this:

$ rm -rf *\~

Or, delete the files by their inode number.

To ignore this backup files from the ls output, use the -B argument: ls -B /path/to/dir.

OR, create this alias:

$ alias lhb="ls --hide='*~'"

To add this alias persistent, append the upper line to your ~/.{bash,zsh}rc file.

Tagged with: , , , , , , , , , ,
Posted in The Linux and Unix Articles!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Subscribe

  

Subscribe to get the latest Linux news and how to guides directly on your e-mail!