PDA

View Full Version : Problem with ~ files produced by gedit



Alerander
4th November 2005, 12:26 PM
Hi there!
I'm using Fedora 4 with GNOME, i found that if i edit some documents with gedit, it would produce a hidden ~ file, i don't know why and even don't know how many this kind files in my HD. Does this file useful? If not, Any one can teach me write a script to delete all of them automatically? I have been using linux for 4 months but didn't learn much bash.
Thanks a lot! Any help will of course be highly apperciated!

brandor
4th November 2005, 02:50 PM
I'm not 100% sure, but I think those files are created by gedit to edit instead of the real file to prevent damage to the file in case of a crash or something. Once you click the Save button, it saves that file as the real file.

They are nothing to worry about.

Alerander
4th November 2005, 03:40 PM
Oh..but actually, i still could see ~ files so long after my editing file! They might be their although i had saved changes.

RichardNash666
4th November 2005, 03:55 PM
The only files I get left over from using gedit are filename.extension~ files in the same dir as you original file. These are backups of the file so you can get the file back if you need to roll back your change easily.

If you want to delete all files with a filename ending in ~ you could as root user from the root directory (/ not the root home directory) type rm -r *~. This is a very dangerous command to type as if you mis-type you could wipe your entire installation....but would clear a lot of space. Check the man pages for rm as I am sure there is a flag you can set to force it to confirm the files to be deleted.

You could also bve a little more fancy using find / -name *~ -print and then pipe this to a command to delete the files...but I can't remember how to do that at the mo...but I seem to remember that the man on find gives some suitable examples.

I hope that my mindless meanderings have helped...adn not hindered too much

Cheers

R

smfinley
4th November 2005, 06:50 PM
In gedit go to "Edit" > "Preferences" and under the "Editor" tab untick the checkbox for "Create a backup copy before saving".

voam
4th November 2005, 11:38 PM
In gedit go to "Edit" > "Preferences" and under the "Editor" tab untick the checkbox for "Create a backup copy before saving".
BINGO! :D
1. The message you have entered is too short. Please lengthen your message to at least 10 characters. :mad:

Alerander
5th November 2005, 03:26 AM
In gedit go to "Edit" > "Preferences" and under the "Editor" tab untick the checkbox for "Create a backup copy before saving".
Yes, it is! It's a ROOT way to solve this problem! Thank you very much!
And RichardNash666, your find command is very good as well to delete current exsit ~ files! The whole command to do so is:

[root@workstation:/home/leeyee]$find / -name "*~" -print -exec rm -f {} \;

thanks!