Using the above we can run commands across a number of process, making them faster...xargs
-P N Run up to N PROGs in parallel
Parallel runs of up to `max-procs` processes at a time; the default is 1. If `max-procs` is 0, xargs will run as many processes as possible at a time:
Code: Select all
arguments_source | xargs -P max-procs command
I haven't tried it.. But figure Pkg would be a good script to test this in ..
It could be used on slow cat, grep, cut, sort, cp, rm, tar, dpkg, commands (etc) ... or when processing large file lists..
I have no idea whether or not it would work if you piped it a shell function ...