How to resume interrupted downloads using Wget
Wget is a command-line utility for downloading files from the internet, commonly used in Linux and Unix-like systems. Downloads can be interrupted for various reasons, such as network failures or accidental system shutdowns. In such cases, restarting the download can lead to wasted time and bandwidth, especially with large files.
Wget provides an option to resume interrupted downloads, making it an efficient tool for downloading large or long files. The resume feature allows the program to continue downloading from where it stopped. It detects the partially downloaded file and downloads only the remaining portion without starting over.
This ability depends on whether the server supports byte-range requests, which is required to resume a download. Not all servers allow this, so Wget will only work for resuming if the server has this functionality enabled. If supported, you can easily resume the download using the correct Wget options.
Steps to resume an interrupted download using Wget:
- Open the terminal.
- Navigate to the directory where the partially downloaded file is located. $ cd ~/Downloads
The -c or --continue option tells Wget to continue downloading from where it was interrupted. It checks the size of the existing file and resumes from there.
- Monitor the progress in the terminal to ensure the download is continuing.
- Wait until the download is complete. large-file.zip 100%[+++++++++++++++] 976M 12MB/s in 41s
Checking the file’s checksum ensures the download was not corrupted. Use the provided checksum to validate the file.
Comment anonymously. Login not required.
Stack Exchange Network
Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
How do I pause/resume download and install from terminal?
I mostly use terminal for installation of programs (as does mostly everybody). However, at times (particularly when I have low battery and no charger wire OR more importantly, when installer file is too big, installation is incomplete and I need to power down my system ) I would like to pause the installation (while it is in downloading state) so that I won't loose already downloaded files.
How do I do this?
- installation
- command-line
- Wouldn't it be simpler not to start a long installation when the battery is low? I thought "everybody" new about that. – mikewhatever Commented Nov 19, 2012 at 12:11
- I start installation with considerable battery (mostly >90%). But I have a slow bandwidth connection and a power saving problem. I get max 25 kB/s on downloads (sometimes 30 kB/s at night). Also focus is on the second condition as that is more frequently occurring. – VedVals Commented Nov 19, 2012 at 12:48
3 Answers 3
Ctrl + c cancels it but next time start from where you left Ctrl + z stops process but then you can't do another process as it remains locked to the first process
Using one of the above methods is generally better than just closing the terminal, but if you just close the terminal while it's downloading packages, it should start the download right where it stopped next time you run sudo apt-get upgrade
If you want to restart the download after using Ctrl + z :
- Check paused tasks by typing jobs in the terminal
- To resume a process, type fg
- If you have multiple tasks, then type fg 1 , fg 2 , etc…
Make sure, however, that you never stop it while it's installing the downloaded packages, since this will result in a lock on apt-get, which will require a computer restart or reconfiguration of apt, and you'll have to start at the beginning of the installation. So make sure to only "pause" (close) the terminal when it's downloading, not installing.
If you would like to start another apt-get process - after pausing the first process, run sudo rm /var/lib/dpkg/lock && sudo rm /var/cache/apt/archives/lock ; it won't look like it did anything, but you should be able to start another apt-get process.
To kill a command that you've paused with Ctrl + z , enter kill -9 %x into the terminal, replacing x with the number that the paused process is (see jobs ). The process will remain in the list, but it will say "killed" after it instead of "stopped", indicating it is no longer active.
Sources : [ubuntu] How to pause download operation in terminal Accidently pressed Ctrl-Z in a Linux terminal in Ubuntu Intrepid Ipex. What do I do now? Starting, Stopping and Managing Jobs in the Ubuntu Terminal
- Tried the answer. Now how to resume? – VedVals Commented Nov 19, 2012 at 13:40
- @ved2254 Just use fg , assuming you haven't started any other processes. I added it to the answer for consistency. – ananaso Commented Nov 19, 2012 at 13:45
- I'm not on my home computer right now, so I'll test this when I get home, but typing fg or fg 1 should "unpause" it. – ananaso Commented Nov 19, 2012 at 14:05
- It works. On a side note, I had to stop it as it couldn't connect to the servers. Does this tend to happen? Tried to install Ubuntu Ultimate Edition Theme Pack – VedVals Commented Nov 19, 2012 at 14:13
- 1 I added the instructions to the post - sudo rm /var/lib/dpkg/lock && sudo rm /var/cache/apt/archives/lock should unlock it, yet keep the old process so you can recall it later. I think it's just with that package, since I anything else I recall with fg runs like normal, without any server errors. Don't really know what else, sorry. :/ Maybe if you start a new thread someone more knowledgeable could take a look at it. – ananaso Commented Nov 22, 2012 at 2:03
Find the answer on how I solved it here. or follow this link https://superuser.com/a/1388933/979057 . I run grep VERSION /etc/os-release VERSION="2019.1" VERSION_ID="2019.1" Linux psycho 4.18.0-kali3-amd64 #1 SMP Debian 4.18.20-2kali2 (2018-11-30) x86_64 GNU/Linux
If you want to pause the downloaded files from terminal, I hope you have downloading something url. Just copy it first. and enter this lines in that terminal
It can pulse the downloading files. Where as you want to resume to download or even after net is disconnected, want to resume the file. Simply run this in terminal:
- 1 a little confusing. We want apt-get, not wget – Find Me In The Woods Commented Jun 2, 2015 at 14:20
- What are you trying to pulse? – yaakov Commented Jan 30, 2017 at 1:14
You must log in to answer this question.
Not the answer you're looking for browse other questions tagged installation command-line apt ..
- The Overflow Blog
- We'll Be In Touch - A New Podcast From Stack Overflow!
- The app that fights for your data privacy rights
- Featured on Meta
- More network sites to see advertising test
- We’re (finally!) going to the cloud!
- Do we want heavily-downvoted questions to appear on the Meta AU homepage?
Hot Network Questions
- Is recursive variable assignment bad even if recursively assigning single row?
- How to draw this matrix with stairs and submatrices?
- Density in the real line
- What kind of range hood do I need?
- Is my evaluation for this multiple linear regression correct?
- Is there a theorem in metaphysics that basically says, "Biting the bullet will be inevitable in any metaphysical theory?"
- Did Superdana manufacture a 66 AC outlet power strip/surge protector?
- Does the earliest known use of an "average" occur after the invention of calculus?
- Brushing pastries with jam
- Categories in which isomorphism of stalks does not imply isomorphism of sheaves
- Dantzig-Wolfe Decomposition for nurse Scheduling problem
- Stable points in GIT: geometric picture
- Was it really possible to damage my VGA card by programming it in assembly through its latches registers?
- What is the best language to speak with locals in Singapore?
- Lowest processable signal level after FFT with given noise level
- Asymptotic Expansion of a Recurrence Relation Involving a Square Root
- How many colors do we need?
- How to detect if the KERNAL load/save routine is currently active on a CBM system?
- What is the Calvinist/Reformed solution to the Problem of Hell?
- Testing Puzzles for Puzzle Book: Enigmatic Puzzle
- What is it called when you have a hobby where you're good enough at to impress others but you yourself know you're only beginning?
- Do longer papers (all other things being equal!) have lower chances of being accepted because they take up more "space" in a journal issue? (STEM,ACM)
- Commencement and repeal dates in UK Acts of Parliament - meaning of "From and after"
- Why does C#'s Thread.MemoryBarrier() use "lock or" instead of mfence?
IMAGES
VIDEO