News for hackers. Stuff that matters.
Re:Awesome but commonly unknown Linux Commands by planckscnst on Wednesday August 10, 2011 @07:52AM (#2867775)
find -exec is almost always faster and more secure than xargs.
Re:Awesome but commonly unknown Linux Commands by burgerbrain on Wednesday August 10, 2011 @09:42AM (#2868111)
It is my understanding that -exec is almost always slower, since it generally needs to invoke whatever program you are using many many times more.
Re:Awesome but commonly unknown Linux Commands by e1ven on Wednesday August 10, 2011 @08:37AM (#2867894)
Whereas I almost always use for i in `find . -name foo`; do mv $i $i-new; done

That's very straightforward, and gets the job done without much weirdness.

Re:Awesome but commonly unknown Linux Commands by michaelcampbell on Wednesday August 10, 2011 @10:37AM (#2868391)
I'd like to hear some justification, cites, or examples for either of these assertions.
Re:Awesome but commonly unknown Linux Commands by planckscnst on Wednesday August 10, 2011 @11:44AM (#2868729)
I was mis-remembering the "faster" part. It is slower unless you have a version that supports the "-exec {} +" option. However, for security and robustness, see this:

http://stackoverflow.com/questions/896808/find-exec-cmd-vs-x... http://www.gnu.org/software/findutils/manual/html_node/find_...

Re:Awesome but commonly unknown Linux Commands by fluidcruft on Wednesday August 10, 2011 @09:58AM (#2868187)
Does find have an equivalent for xargs "-P max" flag?
Re:Awesome but commonly unknown Linux Commands by tange on Thursday August 11, 2011 @07:30AM (#2872354)
You can emulate it with sem:

    find . -exec sem --id my_find -j3 sleep 4\; echo {} \;
See more about sem: http://www.gnu.org/software/parallel/sem.html