Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a app / command that will hunt for specified files ( thumbs.db, .m3u and similar ) files across my home dir and delete them?

share|improve this question
up vote 4 down vote accepted

Not forgetting the use of '*' in the search... use one of these. The find command has a delete switch, but it is more common to see and use the exec option.

find ~ -type f -name \*.m3u -delete
find ~ -type f -name \*.m3u -exec rm -rf {} \;

Or you could use -regex not -name.

share|improve this answer
How would i make a script to print on the terminal what files it deleted? I ran find ~ -type f -name *.m3u -exec rm -rf {} \; and did not get any message, just /home without any trace of .m3u :) – Bojan Jan 10 '11 at 15:24
change the exec statement to: echo "Deleting {}"; rm -rf {} \; – Oli Jan 10 '11 at 15:31
Thanks, Oli, re: mp3 -> m3u. – user8290 Jan 10 '11 at 15:34
@Oli: not so good. find ~ -type f -name \*.m3u -okdir rm -rf {} \; asks for confirmation. – user unknown Mar 20 '11 at 0:27
I guess -delete is just newer, so you don't see it too often. Older gurus don't look into the man page any more. The r in -rf is wrong for -type f, but -delete would delete empty directories, if they're empty. – user unknown Mar 20 '11 at 0:35

None of the others are wrong, but before letting something off like this, make sure you test it without the exec or delete flags so you can just see what files it's matching!


find ~ -name "thumbs.db"

I might even go one further and say perhaps have the files moved into your trash (instead of being straight-deleted) so at least you can undo the process:

find ~ -name "thumbs.db" -exec gvfs-trash {} \;
share|improve this answer

That can be done from the terminal with the following command, use it with CAUTION:

find $HOME -name "thumbs.db" -exec rm {} \;

It will starting search your home dir for files matching that name and will execute rm (remove) on them.

share|improve this answer
+1 for CAUTION ;) – Takkat Jan 10 '11 at 14:03

Open a terminal and execute this command.

 find ~/ -name thumbs.db -type f -print | xargs rm -f
share|improve this answer
useless use of xargs. – user unknown Mar 20 '11 at 0:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.