[Discuss] xargs guide

Daniel Hagerty hag at linnaean.org
Sat Aug 1 12:36:26 EDT 2015


Bill Ricker <bill.n1vux at gmail.com> writes:

> | xargs has advantages over -exec.
> + Can take multiple files per exec if supported, e.g. 'rm', massively
> reducing the exec() overhead.
> + can work with sources of filenames other than find

    You misunderstand.  You are thinking of "find -exec {} ;" which is
an exec per found object.

find $find_args -print0 | xargs -0 $command

is approximately

find $find_args -exec $command {} +

with some other small optimizations you can get by having this canonical
idiom open coded into find.  It saves brain cells, it doesn't obsolete
xargs.



More information about the Discuss mailing list