Vamsi Pavan’s Place

When curiousity outbursts …..

Recursive execusion of commands in Linux command prompt

December 6th, 2006 · No Comments · Linux, Shell

When we want to execute any command recursively for a directory, we can use find command for that.

find . -name 'blah*' -exec rm -rf {} ;

But some times, it gives the error as Argument list too long. In that kind of situations, we better we go for this.

find . -name 'blah*' -print0 | xargs -0 rm -rf

In the above case, did the trick without complaining (because it sends the results of find to rm one by one, rather than in one large batch).


Bookmark it! These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • StumbleUpon
  • BlinkList
  • YahooMyWeb
  • NewsVine
  • blogtercimlap
  • Netvouz
  • Technorati
  • Slashdot
  • Print this article!

Tags:

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment