Video:How to Use the Wget Command on Linuxwith Zoya Popova
The 'wget' command in Linux is an easy way to download the contents of a web page. This Linux video from About.com will show you how to properly use the 'wget' command.See Transcript
Transcript:How to Use the Wget Command on Linux
Hi, I'm Zoya Popova for About.com, and today I'm going to show you how to use the 'wget' command in Linux.
Meaning of 'Wget' Command in Linux
'Wget' allows you to download the contents of any web page. All you have to do is follow the 'wget' command with the address of the page. In our first example, let's download the contents of the About.com Computing page: wget compute.about.com.
In the output, I can see that the file has been saved to my computer as 'index.html.' By default, it has been placed in my current directory - /home/zoya. If I open this file with a web browser, it will show the exact same page as the one located at About.com. If I open it with a text editor, it will display the HTML code for the same page.
Save Web Pages Under New Names Using 'Wget'
'Index.html' is a very generic name, so what if I wanted to save this web page under a different name? Well then I would use the option '-O.' In our previous example, let's introduce the option '-O,' followed by the name of the file to which I want to save the webpage: wget -O /home/zoya/Documents/computing-page compute.about.com
In this example, the page will be saved to the file "computing-page.html" within my Documents directory.
Saving Elements of a Web Page
In addition to saving the web page as a whole, you can save elements of a web page, as long as you know their web locations. Here's an example of a very large file, 4.2 GB in size. If I right-click the link to the file and select "Copy Link Location," I will be able to paste that location into my command line: wget http://mirror.anl.gov/pub/ubuntu-iso/DVDs/ubuntu/maverich/release/ubuntu-10.10-dvd-amd64.iso
This time around, because the file is so large, we actually get to see the download in progress. At this point, you can see we have 49 MB of the 4.2 GB downloaded.
A great feature of 'wget' is that it allows you to pick up the download of a file from a point where it was previously interrupted. To show you how it works, I will manually stop the download by hitting Ctrl+C, and we'll bring up our previous command. This time, we'll add the option '-c,' which stands for 'continue,' and continues the download of an incomplete file from where you left off: wget -c http://mirror.anl.gov/pub/ubuntu-iso/DVDs/ubuntu/maverich/release/ubuntu-10.10-dvd-amd64.iso.
What's even better, this will work even if you started downloading your file with another downloading tool.
And this is it for us for today. Thank you for watching, and for more information please visit us at About.com.