How can I delete every file on the system which have something in the name?
Asked
Active
Viewed 6,740 times
1 Answers
3
Please be careful
This following command with the parameter -delete deletes all the files with something in the name in the specified directory and in all subdirectories.
Open a terminal and go to the right folder:
cd <your_search_starts_here>
test with
find . -type f -name "*something*"
and delete with
find . -type f -name "*something*" -delete
Or a shorter version:
find <your_search_starts_here> -type f -name "*something*" -delete
For your home folder:
!!! first run a test
find ~ -type f -name "*something*"and than
find ~ -type f -name "*something*" -delete
For the whole filesystem
!!! first run a test !!!
sudo find / -type f -name "*something*"and test again and than delete with
sudo find / -type f -name "*something*" -delete
Or only in the specified directory:
find <your_search_starts_here> -maxdepth 1 -type f -name "*something*" -delete
And because you have used the tag locate:
The results of a search with locate are based on a database. This may be outdated. Start an update with sudo updatedb. find performs a true search. However, it also takes longer.