Tuesday, May 24, 2011

wget Usage: The Beginner's Guide

wget is a pretty nifty little program. wgs. et stands for web get, which does what the name says it will download an entire website if given the appropriate commands and argument. This is what this post and future posts will teach you about. Pretty soon you will be wgetting all sorts of things. Like my papa use to say you have to learn to crawl before you can spit. (I don't know what he meant by that but it is what he said, and sounds like good advice.) So on with the basics:

wget Basics
Say you wanted to get the homepage of a website you would use this syntax:

wget http://www.myhomesite.com

and what would be got from that command would be the index.html file. It would be saved into whatever directory you ran the wget command in. usually the /home directory in Linux.

Sometime you will run into of an error whenever wget times out. The default time is 25 tries to get a file, and for big files you may not be able to get the file such as a picture or video. So why not change the default? You can do that with the -t command:

wget -t 34 http://www.myhomesite.com/promo.mov

This downloads the promo.mov file, but since I know that it is a large file I want to give it a longer time period to try to download the file. So I extended the number of tries to 34 attempts.

Say you want to document the output of what you did instead of just having it appear on the screen. You can save the output into a file for review or documentation for later. Just add the -o command like this:

wget -o log http://www.myhomesite.com 


That is about it for basics of wget. Stay turned for some more hair tingling wget commands coming soon.


The Linux Redneck, signing out. :)
 

No comments:

Post a Comment