|
|
|
|
|
by sjs
5029 days ago
|
|
It's most common use is to take some stuff on stdin and then use those as arguments to a command. Here is a fancy way to do `ls * `[1] using xargs: find . -print | xargs ls
`find` dumps the results to stdout, the pipe shuttles `find`'s stdout to `xargs` stdin, `xargs` uses its stdin as arguments for `ls`.(Don't run this in your home directory) [1] Pedants will realize this is actually equivalent to `ls .* *` as hidden files are found by `find`. |
|
Note also that "-print" is the default command for find, so you can leave it off. Other commands include -print0 (NUL-delimited instead of newline-delimited) and -exec.