Tuesday, December 13, 2005

how to delete annoying backup files ending in ~

Here's a one line command, tested on my system (but test it on yours first), to recursively remove the backup files (ending in ~) that tend to clutter up a system.

[root@sriram mybox]find ./ -name '*~' -exec rm -v {} \;

I believe the same command, substituting anything else - "\*.bak" for instance - would work as well. I ran this from my home directory, and it cleaned out the correct files -- and ONLY those -- in a matter of moments.

Note: I just edited the above. For some reason, it stopped running after a recent upgrade. The changes above make it work again.