Find notes

From Noah.org
Revision as of 17:01, 6 June 2007 by Root (talk | contribs) (New page: Category:Engineering You see some people pipe find output into xargs, but other people start a command using -exec. You wonder what the difference is. The difference is that xargs is f...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

You see some people pipe find output into xargs, but other people start a command using -exec. You wonder what the difference is. The difference is that xargs is faster. It will intelligently group arguments and feed batches to the subcommand, so it doesn't have to start a new instance of the subcommand for every argument.

Generally I find -exec easier to use because you can easily repeat the found filename in the exec argument. The xargs command comes in handy in other places such as a stream not generated by find, but when using find I stick with -exec unless I have a good reason not to.