OnCallReadyStart learning

xargs: build and execute command lines from standard input

xargs [-n N] [-I STR] [-0] [-r] [-P N] command

Options you will use

-n N
Use at most N arguments per command line.
-I STR
Replace STR with the input line; implies one line per command.
-0, --null
Input items are NUL-separated. Pairs with find -print0 and survives spaces in names.
-r, --no-run-if-empty
Do not run the command if the input is empty.
-P N
Run up to N commands in parallel.
-t, --verbose
Print each command line before running it.

Examples

$ find . -name "*.log" -print0 | xargs -0 rm

safe with spaces

$ cat hosts | xargs -I{} ssh {} uptime

one run per line

Try xargs in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.