1. Computing & Technology

Discuss in my forum

Example uses of the command "wget"

A Brief Introduction

By , About.com Guide

In order to download the web page google.com you would type

wget linux.about.com
and the result will be saved in a file "index.html" in the current directory. You can open and view the file with a web browser.

If there are connection problems wget will try up to 20 times to reconnect. You can use the -t option to change the maximum number of attempts. For example, with


wget -t 10 linux.about.com
it will try only up to 10 times.

Instead of having the progress messages displayed on the standard output, you can save it to a log file with the -o option:


wget -o logfile linux.about.com

To run it in the background you would put an ampersand at the end as usual:


wget -o logfile linux.about.com &
To download a copy of a complete web site, up to five levels deep, you use the -r option (for recursive):

wget -r linux.about.com -o logfile
To enable offline viewing of this web site, you need to convert the links to point to the downloaded files. This is done as follows:

wget --convert-links -r linux.about.com -o logfile
Finally, yo make sure all files linked to in the documents are are downloaded to enable complete offline viewing, you can use the the -p option:

wget -p --convert-links -r linux.about.com -o logfile

For a complete description of all the options of the wget command see the wget man page, or type


wget --help
at the command line.

©2012 About.com. All rights reserved.

A part of The New York Times Company.