Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

xargs(1) [bsd man page]

XARGS(1)						      General Commands Manual							  XARGS(1)

xargs - construct argument list(s) and execute utility SYNOPSIS
xargs [ -t ][[ -x ] -n number ][ -s size ][ utility [ arguments... ]] DESCRIPTION
The xargs utility reads space, tab, newline and end-of-file delimited arguments from the standard input and executes the specified utility with them as arguments. The utility and any arguments specified on the command line are given to the utility upon each invocation, followed by some number of the arguments read from standard input. The utility is repeatedly executed until standard input 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 back- slash. The options are as follows: -n number Set the maximum number of arguments taken from standard input for each invocation of the utility. An invocation of utility will use less than number standard input arguments if the number of bytes accumulated (see the s option) exceeds the specified size or there are fewer than number arguments remaining for the last invocation of utility. The current default value for number is 5000. -s size Set the maximum number of bytes for the command line length provided to utility. The sum of the length of the utility name and the arguments passed to utility (including /dev/null terminators) will be less than or equal to this number. The current default value for size is ARG_MAX - 2048. -t Echo the command to be executed to standard error immediately before it is executed. -x Force xargs to terminate immediately if a command line containing number arguments will not fit in the specified (or default) command line length. If no utility is specified, echo(1) is used. Undefined behavior may occur if utility reads from the standard input. The xargs utility exits immediately (without processing any further input) if a command line cannot be assembled, utility cannot be invoked, an invocation of the utility is terminated by a signal or an invocation of the utility exits with a value of 255. The xargs utility exits with a value of 0 if no error occurs. If utility cannot be invoked, xargs exits with a value of 127. If any other error occurs, xargs exits with a value of 1. SEE ALSO
echo(1), find(1) STANDARDS
The xargs utility is expected to be IEEE Std 1003.2("POSIX") compliant. June 6, 1993 XARGS(1)

Check Out this Related Man Page

XARGS(1L)																 XARGS(1L)

xargs - build and execute command lines from standard input SYNOPSIS
xargs [-0prtx] [-e[eof-str]] [-i[replace-str]] [-l[max-lines]] [-n max-args] [-s max-chars] [-P max-procs] [--null] [--eof[=eof-str]] [--replace[=replace-str]] [--max-lines[=max-lines]] [--interactive] [--max-chars=max-chars] [--verbose] [--exit] [--max-procs=max-procs] [--max-args=max-args] [--no-run-if-empty] [--version] [--help] [command [initial-arguments]] DESCRIPTION
This manual page documents the GNU version of xargs. xargs reads arguments from the standard input, delimited by blanks (which can be pro- tected with double or single quotes or a backslash) or newlines, and executes the command (default is /bin/echo) one or more times with any initial-arguments followed by arguments read from standard input. Blank lines on the standard input are ignored. xargs exits with the following status: 0 if it succeeds 123 if any invocation of the command exited with status 1-125 124 if the command exited with status 255 125 if the command is killed by a signal 126 if the command cannot be run 127 if the command is not found 1 if some other error occurred. OPTIONS --null, -0 Input filenames are terminated by a null character instead of by whitespace, and the quotes and backslash are not special (every character is taken literally). Disables the end of file string, which is treated like any other argument. Useful when arguments might contain white space, quote marks, or backslashes. The GNU find -print0 option produces input suitable for this mode. --eof[=eof-str], -e[eof-str] Set the end of file string to eof-str. If the end of file string occurs as a line of input, the rest of the input is ignored. If eof-str is omitted, there is no end of file string. If this option is not given, the end of file string defaults to "_". --help Print a summary of the options to xargs and exit. --replace[=replace-str], -i[replace-str] Replace occurences of replace-str in the initial arguments with names read from standard input. Also, unquoted blanks do not termi- nate arguments. If replace-str is omitted, it defaults to "{}" (like for `find -exec'). Implies -x and -l 1. --max-lines[=max-lines], -l[max-lines] Use at most max-lines nonblank input lines per command line; max-lines defaults to 1 if omitted. Trailing blanks cause an input line to be logically continued on the next input line. Implies -x. --max-args=max-args, -n max-args Use at most max-args arguments per command line. Fewer than max-args arguments will be used if the size (see the -s option) is exceeded, unless the -x option is given, in which case xargs will exit. --interactive, -p Prompt the user about whether to run each command line and read a line from the terminal. Only run the command line if the response starts with `y' or `Y'. Implies -t. --no-run-if-empty, -r If the standard input does not contain any nonblanks, do not run the command. Normally, the command is run once even if there is no input. --max-chars=max-chars, -s max-chars Use at most max-chars characters per command line, including the command and initial arguments and the terminating nulls at the ends of the argument strings. The default is as large as possible, up to 20k characters. --verbose, -t Print the command line on the standard error output before executing it. --version Print the version number of xargs and exit. --exit, -x Exit if the size (see the -s option) is exceeded. --max-procs=max-procs, -P max-procs Run up to max-procs processes at a time; the default is 1. If max-procs is 0, xargs will run as many processes as possible at a time. Use the -n option with -P; otherwise chances are that only one exec will be done. SEE ALSO
find(1L), locate(1L), locatedb(5L), updatedb(1) Finding Files (on-line in Info, or printed) XARGS(1L)
Man Page

Featured Tech Videos