Skip to content

Instantly share code, notes, and snippets.

@akashrajkn
Created November 6, 2015 06:09
Show Gist options
  • Save akashrajkn/45b6706c6f6fe13770df to your computer and use it in GitHub Desktop.
Save akashrajkn/45b6706c6f6fe13770df to your computer and use it in GitHub Desktop.
download large file in parts using curl in linux
#!/bin/sh
#This script can be used as a sort of download accelerator and also it can be used to download large files from a url in parts.
#Here, as an example, I've used it to download the kubuntu 15.10 version
#url1, url2, url3, url4 are user-defined variables
url1=http://d33vwem6kwnf57.cloudfront.net/kubuntu-15.10-desktop-amd64.iso
url2=http://d33vwem6kwnf57.cloudfront.net/kubuntu-15.10-desktop-amd64.iso
url3=http://d33vwem6kwnf57.cloudfront.net/kubuntu-15.10-desktop-amd64.iso
url4=http://d33vwem6kwnf57.cloudfront.net/kubuntu-15.10-desktop-amd64.iso
curl --range 0-200000000 -o kubuntu-iso.part1 $url1 &
curl --range 200000001-400000000 -o kubuntu-iso.part2 $url2 &
curl --range 400000001-600000000 -o kubuntu-iso.part3 $url3 &
curl --range 600000001- -o kubuntu-iso.part4 $url4 &
#after download, the initial iso image is now downloaded as 4 different parts,
#the following command can be used to join the files together
# $ cat kubuntu-iso.part? > kubuntu-15.10-desktop-amd64.iso
@akashrajkn
Copy link
Author

can be used to download large files in parts (helpful if there is a file-size limit per download :P )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment