Wget: Resume Broken Download



The GNU Wget is a free utility for non-interactive download of files from the Web. It supports HTTP, HTTPS, and FTP protocols, as well as retrieval through HTTP proxies. Recently, I was downloading a Ubuntu Linux ISO (618 MB) file for testing purpose at my home PC. My Uninterrupted Power Supply (UPS) unit was not working. I started download with the following wget command:



$ wget http://ftp.ussg.iu.edu/linux/ubuntu-releases/5.10/ubuntu-5.10-install-i386.iso

However, due to power supply problem, my computer rebooted at 98% download. Again, after reboot I typed wget at a shell prompt:

$ wget http://ftp.ussg.iu.edu/linux/ubuntu-releases/5.10/ubuntu-5.10-install-i386.iso

However, wget restarted to download ISO image from scratch again. I thought wget should resume partially downloaded ISO file.

ADVERTISEMENTS



wget resume download

After reading wget(1) GNU Linux man page, I found the -c or --continue option to continue getting a partially downloaded file. This is useful when you want to finish a download started by a previous instance of wget, or by another program. The syntax is:

wget -c url wget --continue url wget --continue [ options ] url wget -c url wget --continue url wget --continue [options] url

So I decided to continue getting a partially-downloaded ubuntu-5.10-install-i386.iso file using the following command:

$ wget -c http://ftp.ussg.iu.edu/linux/ubuntu-releases/5.10/ubuntu-5.10-install-i386.iso

OR

$ wget --continue http://ftp.ussg.iu.edu/linux/ubuntu-releases/5.10/ubuntu-5.10-install-i386.iso

Sample session:



Make sure your run wget command in the same directory where the first download started. If there is a file named ubuntu-5.10-install-i386.iso in the current directory, Wget will assume that it is the first portion of the remote file, and will ask the server to continue the retrieval from an offset equal to the length of the local file. Thus, it will result in saving both time and bandwidth.

For more information about the wget, read man pages:

$ man wget

$ wget --help

See also:

Category List of Unix and Linux commands File Management cat Network Utilities dig • host • ip • nmap Package Manager apk • apt Processes Management bg • chroot • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time Searching grep • whereis • which User Information groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w