Many text editors create backup files with names ending with “~”.
Most of the times these files are annoying and unnecessary…
So, you can use the following piped commands to remove them :
find / | grep "^.*~$" | sed -e 's/\(^.*$\)/"\1"/g' | xargs rm -f > /dev/null 2>&1
Please take account that this version handles correctly also filepaths containing space characters.
The approach of P. Christeas as I have written is only for GNU find version which probably is located in a GNU/Linux operating system.
However, the article is more general since there is no reference to GNU operating systems (e.g. GNU/Linux, GNU/Hurd).
Dude… P. Christeas approach is the correct method.
If find missing delete then its not a GNU/Linux distro.
There are many ways to achieve this.
I didn’t want to use ‘-delete’ since this option might be missing from some versions of ‘find’.
We could use also ‘-exec rm’ but both ‘-delete’ and ‘-exec’ are for GNU find.
Other versions might not have these smart options yet.
find -name ‘*~’ -delete