Boston Linux & UNIX was originally founded in 1994 as part of The Boston Computer Society. We meet on the third Wednesday of each month, online, via Jitsi Meet.

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss] xargs guide



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.



Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org