Download Files In Parallel

HongHong
1 min read

This is a quick way to download files from different URLs in parallel.

List all URLs in a file urls.txt

https://example.com/file1.zip
https://example.com/file2.zip
https://example.com/file3.zip
https://example.com/file4.zip

One-liner download using wget

cat urls.txt | xargs -P 4 -n 1 wget

-P <max-procs> sets number of parallel processes. Use 0 for maximum.

One-liner download using wget

cat urls.txt | xargs -P 0 -n 1 curl -O

-P <max-procs> sets number of parallel processes. Use 0 for maximum.

0
Subscribe to my newsletter

Read articles from Hong directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Hong
Hong

I am a developer from Malaysia. I work with PHP most of the time, recently I fell in love with Go. When I am not working, I will be ballroom dancing :-)