Process Management
xargs
Build and execute command lines from standard input.
Synopsis
syntax
xargs [OPTION]... [COMMAND [INITIAL-ARGS]]
Examples
Delete all .tmp files found
find . -name '*.tmp' | xargs rm
Download URLs 4 at a time
cat urls.txt | xargs -P 4 -I{} curl -O {}Handle filenames with spaces
find . -name '*.py' -print0 | xargs -0 grep 'import os'
Echo two numbers per line
seq 10 | xargs -n 2 echo
Common options
| Flag | Description |
|---|---|
| -I | Replace string (e.g. -I{} uses {} as placeholder) |
| -n | Max arguments per command invocation |
| -P | Max parallel processes |
| -0 | Input items are NUL-separated |
| -t | Print commands before executing |
About xargs
The `xargs` command build and execute command lines from standard input. Process management commands let you monitor, control, and schedule running processes.
Linux is a multitasking operating system, and understanding how to list processes, send signals, adjust priorities, and manage background jobs is vital for system administration and debugging performance issues. The command accepts 5 commonly used flags shown above, though the full set of options is available in the man page (`man xargs`).
The 4 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.
Related commands
More Process Management Commands
Other commands in the Process Management category