wget is a network downloader, so we can use it to download files from internet. Using wget, you can download webpages, download multiple files, download large files, you can also save offline copy of the webpages and many more. Here, I have covered simple usage and commands of wget which introduces you to wget.
- You can download and save any particular webpage / file:
This downloads the file pointed by the location ‘DESIRED/URL/PATH’.
If ‘DESIRED/URL/PATH’ is webpage, it downloads and saves the page
& if ‘DESIRED/URL/PATH’ is a file, it downloads the file and saves it.
- You can give a new name to the file you are downloading:
wget -O newfilename.tar.gz DESIRED/URL/PATH/TO/FILE
When you are downloading the file, without renaming, it will take the default name (FILE) from the DESIRED/URL/PATH/TO/FILE, and you might not get the proper file name or extension of the downloaded file. So, you can rename the file to be downloaded with proper filename and extension.
- You can specify bandwidth limit to the file being downloaded.
wget —limit-speed=100k newfilename.tar.gz DESIRED/URL/PATH/TO/FILE
This limits the speed of download or bandwidth for downloading the file to 100kb/s. (Helpful to download large file.)
- You can also resume your old, interrupted / incomplete download with -c option.
wget -c —limit-speed=100k newfilename.tar.gz DESIRED/URL/PATH/TO/FILE
No worries if your download got interrupted and leave you with incomplete file. This will help you resume your old download. But make sure that you typed the same filename and are in the same path. (Helpful to download large file.)
- You can also download multiple files using wget. All you need to do is write the list of path in a file and specify the file as follows.
wget -i my_download_list.txt
Make a file my_download_list.txt with the list of URLs separated into different lines. And it will download each of the files mentioned in the list. Make sure, each URLs are in a different line (Helpful to download multiple file.)
- You can also download webpages and save for offline views.
wget —mirror —convert-links DESIRED/URL/PATH
This converts the dynamic contents of the website to static and saves a local copy for offline view.
- Finally, you can run the downloads in background with -b option:
wget -b DESIRED/URL/PATH
This will run the downloads in background, and the progress is updated in a log file wget-log. So, you can monitor the progress with the following command.
tail -f wget-log
This will automatically update and show you the progress.
For further details, you can visit: http://manpages.ubuntu.com/manpages/precise/man1/wget.1.html or hit the command wget —help