- published: 28 Oct 2013
- views: 5132
xargs is a command on Unix and most Unix-like operating systems used to build and execute command lines from standard input. Commands like grep and awk can accept the standard input as a parameter, or argument by using a pipe. However others like cp and echo disregard the standard input stream and rely solely on the arguments found after the command[unreliable source?] . Additionally, under the Linux kernel before version 2.6.23, arbitrarily long lists of parameters could not be passed to a command, so xargs breaks the list of arguments into sublists small enough to be acceptable.
For example, commands like:
<source lang="bash">
</source> or <source lang="bash">
</source> will fail with an error message of "Argument list too long" if there are too many files in /path
.
However the version below (functionally equivalent to rm `find /path -type f`
) will not fail: <source lang="bash">
</source> In the above example, the find
utility feeds the input of xargs
with a long list of file names. xargs
then splits this list into sublists and calls rm
once for every sublist.
soon enough
lay low the law
soon they know
lay low the law
it's really straight forward
yes really it is
round & round 'n bloody round we go
man it is quiz
that i don't understand
& it takes me by the hand
as i try to run it down
till i virtually land &
soon enough
lay low the law
soon they know
lay low the law
shut the doors close the windows
kill the lights there's a hindrance out there
tonight kill the nights steal the difference styles
don't agonize
pace your halls
while the wind blows
climb your walls till it means you've been there
all night feel the fright cause the wind knows right