adds commands to xargs and moves to pages/common

- xargs is also native to OS X
This commit is contained in:
Alex Flores
2015-12-29 00:09:35 -05:00
committed by Igor Shubovych
parent ba3b07cf0c
commit b1d38625d5

19
pages/common/xargs.md Normal file
View File

@@ -0,0 +1,19 @@
# xargs
> Execute a command with piped arguments.
- Main use:
`{{arguments}} | xargs {{command}}`
- Handle whitespace in arguments:
`{{arguments_null_terminated}} | xargs -0 {{command}}`
- Example: list unneeded packages with deborphan and remove them with apt-get:
`sudo deborphan | xargs sudo apt-get remove`
- creating variables: copy all files that start with 'M' to the Desktop
`ls M* | xargs -J % cp % ~/Desktop`