Name

xargs

Synopsis

xargs [options] [command]

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 the command, allowing it 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. The default command is /bin/echo.

Options

−0, --null

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

-a file, --arg-file=file

Read arguments from file, not standard input.

-E string

Set EOF to string. Default is no EOF string.

--help

Print usage information and then exit.

-I string

Replace all occurrences of string in the initial arguments with names read from standard input. Unquoted blanks are not considered argument terminators; newline character is used. Implies -x and -L 1.

-L lines

Allow no more than lines nonblank input lines on the command line (default is 1). Implies -x.

-n args, --max-args=args

Allow no more than args arguments on the command line. Overridden by the maximum number of characters set with -s.

-p, --interactive

Prompt for confirmation (y or Y) before running each command line. Implies -t.

-P max, --max-procs=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.

-r, --no-run-if-empty

Do not run command if ...

Get Linux in a Nutshell, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.