1

search for files and delete from the whole system file

If you create a file or just open a file with some programs like gedit, it will make auto save files named like this file~. For example if i do this gedit file.txt then when i close the file i can find two files file.txt and file.txt~.

What i want to do is to search the "/" whole file system for these files and then delete them. Note that those files could be other things not just text files.Thanks foe helping

rusty
  • 16,917

1 Answers1

1

To delete all backup files ending in ~ from the whole system, you can use:

sudo find / -type f -name '*~' -exec rm -f {} \;

Warning: I suggest you to run first find / -type f -name '*~' to see exactly what you will delete.

Radu Rădeanu
  • 174,089
  • 51
  • 332
  • 407