wget --random-wait -r -p -e robots=off -U mozilla http://www.example.com

Download an entire website

-p parameter tells wget to include all files, including images. -e robots=off you don't want wget to obey by the robots.txt file -U mozilla as your browsers identity. --random-wait to let wget chose a random number of seconds to wait, avoid get into black list. Other Useful wget Parameters: --limit-rate=20k limits the rate at which it downloads files. -b continues wget after logging out. -o $HOME/wget_log.txt logs the output

178
By: starchox
2009-02-17 22:53:07

1 Alternatives + Submit Alt

What Others Think

I think some builds of wget have the -m (mirror) option available as well.
joem86 · 483 weeks ago
The given command does not download an entire web site. It downloads a single page, plus any images and such on that page. For this functionality, the '-r' is not necessary, and the random wait generally isn't either.
ToyKeeper · 463 weeks and 5 days ago
Ignore previous comment. Apparently the default recursion depth is now 5, which is often enough to download entire sites. However, if you want to be sure, add a '-l 0' to remove the recursion depth limit.
ToyKeeper · 463 weeks and 5 days ago
From the man page, useful for offline browsing: -k --convert-links After the download is complete, convert the links in the document to make them suitable for local viewing. This affects not only the visible hyperlinks, but any part of the document that links to external content, such as embedded images, links to style sheets, hyperlinks to non-HTML content, etc.
piccobello · 357 weeks and 1 day ago
-p is not necessary if you're using -r -K will keep copies of original files before modifying links with -k -N for timestamps: useful for refreshing a mirror, only downloading new stuff
johnraff · 340 weeks ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: