Using xargs to parallel a process in the command line


Most of us have multiple CPUs in our personal machines. I would also hope that your servers do too. If you're running an intensive command line process, running them in parallel will speed it up by paralleling the process.

Say you need to find a string in all of your log files. On any server that has multiple programs running there's a lot of log files to run though. Here's an example:

find /var/logs -type f | xargs -P 4 -n 10 grep -H 'string-to-search'  

Read more on xargs
and even more examples