Hide

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. 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.


If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/

Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

Hide

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:

Hide

News

2011-03-12 - Confoo 2011 presentation
Slides are available from the commandlinefu presentation at Confoo 2011: http://presentations.codeinthehole.com/confoo2011/
2011-01-04 - Moderation now required for new commands
To try and put and end to the spamming, new commands require moderation before they will appear on the site.
2010-12-27 - Apologies for not banning the trolls sooner
Have been away from the interwebs over Christmas. Will be more vigilant henceforth.
2010-09-24 - OAuth and pagination problems fixed
Apologies for the delay in getting Twitter's OAuth supported. Annoying pagination gremlin also fixed.
Hide

Tags

Hide

Functions

Download an entire website

Terminal - Download an entire website
wget --random-wait -r -p -e robots=off -U mozilla http://www.example.com
2009-02-17 22:53:07
User: starchox
Functions: wget
152
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

Alternatives

There are 7 alternatives - vote for the best!

Terminal - Alternatives

Know a better way?

If you can do better, submit your command here.

What others think

I think some builds of wget have the -m (mirror) option available as well.

Comment by joem86 291 weeks and 1 day 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.

Comment by ToyKeeper 271 weeks and 6 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.

Comment by ToyKeeper 271 weeks and 6 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.

Comment by piccobello 165 weeks and 3 days 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

Comment by johnraff 148 weeks and 1 day ago

Your point of view

You must be signed in to comment.

Related sites and podcasts