Search for and delete all instances of a file in Linux

The following code will find and delete all instances of a file. It will also print out every filename/path it finds, so you know what it’s deleting.

find /path/to/search -name FilenameToDelete.txt -delete -print

If the command gives you any problems, you can use rm -rf to force deletion of non-empty directories, etc.

find /path/to/search -name FilenameToDelete.txt -print -exec rm -rf {} \;

Use wildcards when necessary, just be careful.