xargs command breaks down the data from standard input into parts small enough to be fed into an unix command that takes input from the argument list only.
Some unix commands can take input from standard input, e.g.,
grep , and
ls. Then there are other commands that take input from the argument list only e.g.,
echo. Then how can we pipe output from some other command into
rm ? By using
The following example shows how
xargs can be used to remove all the zip files in the current directory.
$ ls *.zip | xargs rm