Skip to main content

Batching, One-Per-Item, and Placeholder Modes

xargs [OPTIONS] [COMMAND [INITIAL-ARGS]]

Default Batch Mode

printf 'a\nb\nc\n' | xargs echo

One Item Per Command

printf 'a\nb\n' | xargs -n 1 echo

Placeholder Mode

printf 'file1\nfile2\n' | xargs -I{} mv {} /tmp/

Use -I{} when the input must appear in a specific position.