Skip to content

Latest commit

 

History

History
38 lines (31 loc) · 648 Bytes

xargs.md

File metadata and controls

38 lines (31 loc) · 648 Bytes

xargs

Linux command to run a utility

Group then process multiple lines

xargs -L 3 bash -c 'echo $0 $1' Only single quotes work!!

## Group data then run utility
>>> echo '
Jesus
Christ
0

Tom
Brady
1977' | xargs -L 3 bash -c 'echo $0 $1'
Jesus Christ
Tom Brady

Parallel mode

xargs -I {} -P 5 sh -c 'echo {} $(brew info {} | grep Required)'

>>> brew list -1 --formula | xargs -I {} -P 5 sh -c 'echo {} $(brew info {} | grep Required)'
ca-certificates
bat
dust
coreutils Required: gmp

mv

Use -t with mv to copy multiple files in TARGET directory

fd -t f -0 | xargs -0 mv -t /tmp/