Skip to content


rm on steroids (a safer way)

I came across an excellent tip about mixing rm and find commands in Linux shell.

The only thing I’d add to it is a bit of safety. Before executing the mix of find and rm, run the find command with the same options, but without rm. It will print out the files that match your search. These files are about to be deleted, so it’s a good thing to review them first.

By the way, I do exactly the same thing when working with SQL. If I need to delete something, I first create a SELECT statement that matches everything I need gone. And only when I am sure about the results, I change the SELECT to DELETE.

It’s been ages since I deleted something that I didn’t intend…

Update: Obviously, I haven’t read the comments before posting. My suggestions has already been suggested.

Posted in All.


One Response

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Continuing the Discussion

  1. Linux Information Blog » Blog Archive » Article from Blog of Leonid Mamchenkov - rm on steroids (a safer way) linked to this post on August 2, 2006

    [...] Blog Name: Blog of Leonid Mamchenkov Article Title: rm on steroids (a safer way) I came across an excellent tip about mixing rm and find commands in Linux shell. The only thing I’d add to it is a bit of safety. Before executing the mix of find and rm, run the find command with the same options, but without rm. It will p… [...]



Some HTML is OK

or, reply to this post via trackback.



Rss Feed Tweeter button Facebook button Reddit button Linkedin button Delicious button Digg button Flickr button Stumbleupon button Youtube button