3 ms·
cat list.txt | xargs -n 1 -P 20 wget Queues up 20 concurrent downloads with wget, for example.
by dsl 11y ago
cat list.txt | xargs -n 1 -P 20 wget
Queues up 20 concurrent downloads with wget, for example.
- icebraining 11y agoYou could also use a for loop. But as others pointed out, that doesn't allow you to add items to the queue after it has started.
- stonogo 11y agoIt does if you use a fifo instead of a text file. This is the difference between basic Unix literacy and actual Unix proficiency. I'm not being insulting; very few people take the time to learn the tools Unix provides. And naturally, a developer is going to be more interested in writing tools than most.
- icebraining 11y agoI don't think you can use a fifo with xargs, though it'd definitively work with a loop. Even with text files, using tail -f.
- iokanuon 11y agotail -n+0 -f list.txt | xargs -n 1 -P 20 wget