XARGS(1)

NAME
xargs - construct argument lists and execute command

SYNOPSIS
xargs [-0prtx] [-E eofstr] [-I replstr] [-n num] [-P maxprocs] [-s num] [cmd [arg ...]]

DESCRIPTION
xargs reads space, tab, newline and EOF delimited strings from stdin and executes the specified cmd with the strings as arguments.

Any arguments specified on the command line are given to the command upon each invocation, followed by some number of the arguments read from stdin. The command is repeatedly executed one or more times until stdin is exhausted.

Spaces, tabs and newlines may be embedded in arguments using single (`'') or double (`"') quotes or backslashes ('\'). Single quotes escape all non-single quote characters, excluding newlines, up to the matching single quote. Double quotes escape all non-double quote characters, excluding newlines, up to the matching double quote. Any single character, including newlines, may be escaped by a backslash.

OPTIONS

-0  Change xargs to expect NUL ('\0') characters as separators, instead of spaces and newlines. The quoting mechanisms described above are not performed.

-E eofstr
    Use eofstr as a logical EOF marker.

-I replstr
    Use replstr as the placeholder for the argument. Sets the arguments count to 1 per command line. It also implies the option x.

-n num
    Use at most num arguments per command line.

-p  Prompt mode: the user is asked whether to execute cmd at each invocation. Trace mode (-t) is turned on to write the command instance to be executed, followed by a prompt to standard error. An affirmative response read from /dev/tty executes the command, otherwise it is skipped.

-P maxprocs
    Parallel mode: run at most maxprocs invocations of cmd at once.

-r  Do not run the command if there are no arguments. Normally the command is executed at least once even if there are no arguments.

-s num
    Use at most num bytes per command line.

-t  Enable trace mode. Write the command line to stderr before executing it.

-x  Terminate if the command line exceeds the system limit or the number of bytes given with the [-s] flag.

EXIT STATUS
xargs exits with one of the following values:

0   All invocations of cmd returned a zero exit status.

123 One or more invocations of cmd returned a nonzero exit status.

124 cmd exited with a 255 exit status.

125 cmd was killed or stopped by a signal.

126 cmd was found but could not be executed.

127 cmd could not be found.

1   Some other error occurred.

STANDARDS
POSIX.1-2013.

The [-r] and [-P] flag is an extension to that specification.