XARGS(1)

NAME
xargs - construct argument lists and execute command

SYNOPSIS
xargs [-rtx] [-E eofstr] [-n num] [-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

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

-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.

-E eofstr
    Use eofstr as a logical EOF marker.

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

-t  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
The xargs utility is compliant with the p1003.1-2013 specification except from the [-p] flag.

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