Don't over look the power of xargs. By default
in some flavors of unix, the command line is
limited to roughly 20K bytes.
Some directory lists can well exceed that.
Secondly, performance using
% find /tmp -name foo -exec rm \;
will fork the rm command for every file it
finds. If this were to return 1000s of files
you get rm forked 1000s of times.
But,
% find /tmp -name foo |xargs rm
while getting the same effect, rm is forked
with a long list of files, and thus system
overhead is reduced, and the command runs
faster, and system impact is reduced.
This is also important if you have list of
files produced by
% find {blah} > listfile
Once you edit your list to remove those
files you really want to keep, then
% cat listfile| xargs rm
Will remove all the files in the file. While
% rm $(cat listfile) will
Fail if listfile is greater than ~20K
NOTE: All tips provided are USE AT YOUR OWN RISK. Tips are submitted
by various unix admins around the globe. UGU suggest you read and
test each tip in a non-volitile environment before placing into
production.