1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/common/xargs.md

24 lines
529 B
Markdown
Raw Normal View History

2014-03-12 18:25:30 +01:00
# xargs
> Execute a command with piped arguments.
2014-03-12 18:25:30 +01:00
- Main use:
2014-03-12 18:25:30 +01:00
`{{arguments}} | xargs {{command}}`
- Handle whitespace in arguments:
2014-03-12 18:25:30 +01:00
`{{arguments_null_terminated}} | xargs -0 {{command}}`
- Insert arguments at chosen position, using '%' as the placeholder marker:
2014-03-12 18:25:30 +01:00
`{{arguments}} | xargs -I '%' {{command}} % {{extra_arguments}}`
- Use the output of one command as arguments to another command:
2014-03-12 18:25:30 +01:00
`{{command1}} | xargs {{command2}}`
- Specific example: delete all files that start with 'M':
`find . -name 'M*' | xargs rm`