xargs Command Examples

Execute a command with piped arguments coming from another command, a file, etc. The input is treated as a single block of text and split into separate pieces on spaces, tabs, newlines and end-of-file. More information: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html.

{{arguments_source}} | xargs {{command}}

{{arguments_source}} | xargs sh -c "{{command1}} && {{command2}} | {{command3}}"

find . -name '*.log' -print0 | xargs {{[-0|--null]}} {{[-P|--max-procs]}} {{4}} {{[-n|--max-args]}} 1 gzip

{{arguments_source}} | xargs {{-n|--max-args}} 1 {{command}}

{{arguments_source}} | xargs -I _ {{command}} _ {{optional_extra_arguments}}

{{arguments_source}} | xargs {{[-P|--max-procs]}} {{max-procs}} {{command}}