If you're on an unstable WiFi hotspot or simply forgot about a curl download and shut down your laptop, there's a really cool thing to try: resume download from where you left off.
How To Download a File with curl
I'm downloading the Solus 4.1 release – it's a 1.7GB ISO image. Here's the command line that makes curl download the file and put it into local file (note the -O option):
[email protected]:~/Downloads/try $ curl -O http://solus.veatnet.de/iso/images/4.1/Solus-4.1-Budgie.iso
How To Stop Download with curl
Now, if we press Ctlr+C to stop download, we'll end up with a partially downloaded file:
[email protected]:~/Downloads $ curl -O http://solus.veatnet.de/iso/images/4.1/Solus-4.1-Budgie.iso % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 3 1692M 3 58.8M 0 0 2161k 0 0:13:21 0:00:27 0:12:54 4638k^C
[email protected]:~/Downloads $ ls -la Solus*iso
-rw-r--r-- 1 greys 102318080 Feb 7 22:58 Solus-4.1-Budgie.iso
[email protected]:~/Downloads $ du -sh Solus-4.1-Budgie.iso
How To Resume Download with curl
To resume download (rather than restart and begin downloading the whole file again0, simply use the -C option. It's meant to be taking a specific offset in bytes, but also works if you specify "-", when curl looks at existing file and decides what the offset should be automatically:
That's it, you can let the download complete now:
[email protected]:~/Downloads $ curl -C - -O http://solus.veatnet.de/iso/images/4.1/Solus-4.1-Budgie.iso ** Resuming transfer from byte position 102318080 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1595M 100 1595M 0 0 2868k 0 0:09:29 0:09:29 --:--:-- 1766k
Here's my resulting file:
-rw-r--r-- 1 greys 1774911488 Feb 7 23:08 Solus-4.1-Budgie.iso
Don't Forget to Compare File Checksum!
Checking a checksum for newly downloaded ISO image is always a good practice, but it becomes a must when you're resuming downloads: in addition to ensuring you got the same ISO image software distributors intended, you're getting the assurance that your resumed download file is intact and fully operational.
I have downloaded Solus 4.1 SHA256 checksum from the same Solus Downloads page, and will use the sha256sum command to generate checksum for the ISO file. Obviously, both checksums must match:
[email protected]:~/Downloads $ cat Solus-4.1-Budgie.iso.sha256sum 4bf00f2f50e7024a71058c50c24a5706f9c18f618c013b8a819db33482577d17 Solus-4.1-Budgie.iso [email protected]:~/Downloads $ sha256sum Solus-4.1-Budgie.iso 4bf00f2f50e7024a71058c50c24a5706f9c18f618c013b8a819db33482577d17 Solus-4.1-Budgie.iso
That's it for today! I can't wait to try Solus 4.1, will posh about it shortly.