Hacker News new | ask | show | jobs
by dsl 3944 days ago
cat list.txt | xargs -n 1 -P 20 wget

Queues up 20 concurrent downloads with wget, for example.

1 comments

You 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.
It 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.
I 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.

    tail -n+0 -f list.txt | xargs -n 1 -P 20 wget