utility

xargs

Build argument vectors from input. -0 reads NUL-delimited items; GNU -r skips empty input. Nonzero child statuses can map to xargs-specific statuses.

Formal Syntax & Structure

bash syntaxbash
xargs -0 [-r] COMMAND [ARG ...]

Parameters & Attributes

NameTypeDescription
COMMANDstringExecutable to invoke.
-0optionRead NUL-separated records.
-roptionSkip execution on empty input (implementation-sensitive).

Return Value

exit status

Exit status 0 on success; nonzero indicates failure or a command-specific condition. See description and example.

Working Example

Example Snippetbash
mkdir datatouch -- $'data/line\nbreak.txt'find data -type f -print0 | xargs -0 -r printf '[%s]\n'
Bash Reference