36

How to download a file with wget using multiple connection in which each connection downloads a part of the file?

user2789031
  • 363
  • 1
  • 3
  • 5
  • See also https://stackoverflow.com/questions/3430810/wget-download-with-multiple-simultaneous-connections – Nemo Jun 21 '17 at 20:52
  • 1
    Does this answer your question? [Multiple simultaneous downloads using Wget?](https://stackoverflow.com/questions/3430810/multiple-simultaneous-downloads-using-wget) – OverShifted Jun 30 '21 at 17:36

2 Answers2

39

use aria2

 aria2c -x 16 [url] #where 16 is the number of connections

OR

Just repeat the wget -r -np -N [url] for as many threads as you need. This isn’t pretty and there are surely better ways to do this, but if you want something quick and dirty it should do the trick.

Please look at http://blog.netflowdevelopments.com/2011/01/24/multi-threaded-downloading-with-wget/

peak
  • 88,177
  • 15
  • 123
  • 150
Jayesh Bhoi
  • 22,676
  • 14
  • 57
  • 72
  • 6
    The solution you gave for wget downloads a single file multiple times resulting in multiple copies, but I want to download a single file using multiple connection, each of which downloads its part of file. – user2789031 Mar 01 '14 at 13:18
  • 1
    `wget` solution doesn't download one file in multiple threads: The options used `-r` is recursive, `-np` (`--no-parent`) — don't ascend to the parent directory, `-N` (`--timestamping`) — don't re-retrieve files unless newer than local. But `wget` would definitely work if you're downloading a mirror of a site. – Alexey Ivanov Apr 07 '15 at 14:44
  • @Trix -x, --max-connection-per-server=NUM The maximum number of connections to one server for each download. Possible Values: 1-16 Default: 1 Tags: #basic, #http, #ftp – mlapaglia Feb 09 '16 at 14:38
  • perhaps the flag -nc was intended, not -np – awiebe Dec 06 '17 at 11:11
  • 1
    The link in the answer is 404 – M.M Jan 04 '21 at 09:53
27
sudo apt-get install axel
axel -n 5 url

Would do the work!

Axel is a lightweight program that helps with the downloads and supports multiple connections.

Want to resume download after a disconnection? No problem, just repeat the command and axel will take care of it.

Ash
  • 3,228
  • 1
  • 30
  • 40