Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Awesome but commonly unknown Linux Commands. Parent comment
xargs is "better" in that it spawns 1 new process for however many things are found. -exec spawns 1 new process for EVERY thing found.
So:
find . -name '*.log' -exec rm {} \;
find . -name '*.log' -print0 | xargs -0 rm
xargs also has options to limit command line length or # of items if you want to limit that. find -exec is about the same then as find ... | xargs -n1
There are no comments on this comment yet.
xargs is "better" in that it spawns 1 new process for however many things are found. -exec spawns 1 new process for EVERY thing found.
So:
spawns an rm for every log file. spawns 1 rm for MANY log files. (Yes, I know zsh can do stuff like this too.)xargs also has options to limit command line length or # of items if you want to limit that. find -exec is about the same then as find ... | xargs -n1