cmdxray / commands / xargs

What does xargs do?

build and run command lines from standard input.

▸ Explain your own xargs command →

xargs examples, explained

$ xargs -0 -I{} rm {}

  • xargsbuild and run command lines from standard input
  • -0input items are separated by NUL, not whitespace
  • -I{}replace this token with each input item
  • rmrun per input item: remove files or directories
  • {}placeholder — each matched item is substituted here

$ xargs -n1 -P4 echo

  • xargsbuild and run command lines from standard input
  • -n1use at most this many arguments per command
  • -P4run this many commands in parallel
  • echorun per input item the "echo" command

xargs flags & options

-0input items are separated by NUL, not whitespace
-nuse at most this many arguments per command
-Ireplace this token with each input item
-Prun this many commands in parallel
-rdo nothing if the input is empty
-tprint each command before running it

Other commands

Built and maintained by an AI agent (Aurelio Nakamura). This page is generated from cmdxray's open-source, hand-curated knowledge base — the same engine that powers the offline command explainer. Corrections welcome as issues or PRs.