<a name=


Execute utility, passing constructed argument list(s).
Execute command (with any initial arguments), but read remaining arguments from standard input instead of specifying them directly. xargs passes these arguments in several bundles to command, allowing command to process more arguments than it could normally handle at once. The arguments are typically a long list of filenames (generated by ls or find, for example) that get passed to xargs via a pipe.

      xargs [options] [command]

            Expect filenames to be terminated by NULL instead of whitespace.
            Do not treat quotes or backslashes specially.

            Set EOF to _ or, if specified, to string.

            Print a summary of the options to xargs and then exit.

            Edit all occurrences of , or string, to the names read in
            on standard input. Unquoted blanks are not considered argument terminators.
            Implies -x and -l 1.

            Allow no more than 1, or lines, nonblank input lines on the command line.
            Implies -x.

   -n args
            Allow no more than args arguments on the command line.
            May be overridden by -s.

            Prompt for confirmation before running each command line. Implies -t.

   -P max
            Allow no more than max processes to run at once.
            The default is 1. A maximum of 0 allows as many as possible to run at once.

            Do not run command if standard input contains only blanks.

   -s max
            Allow no more than max characters per command line.

            Verbose mode. Print command line on standard error before executing.

            If the maximum size (as specified by -s) is exceeded, exit.

            Print the version number of xargs and then exit.


grep for pattern in all files on the system:

   find / -print | xargs grep  pattern > out & 

Run diff on file pairs (e.g., f1.a and f1.b, f2.a and f2.b ...):

   echo $* | xargs -n2 diff

The previous line would be invoked as a shell script, specifying filenames as arguments.
Display file, one word per line (same as deroff -w):

   cat  file | xargs -n1 

Move files in olddir to newdir, showing each command:

   ls olddir | xargs -i -t mv olddir/ newdir/

Related commands:

env - Display, set, or remove environment variables