How to download a website in Linux (wget)
The wget is a useful command to download a website in Linux. For example , wget [url].
[mkyong@snake ~]$ wget -r -p -k -E http://www.google.com --2009-07-19 14:07:27-- http://www.google.com/ Resolving www.google.com... 64.233.189.104 Connecting to www.google.com|64.233.189.104|:80... connected. HTTP request sent, awaiting response... 302 Found Location: http://www.google.com.my/ [following] --2009-07-19 14:07:27-- http://www.google.com.my/ Resolving www.google.com.my... 64.233.189.147 Connecting to www.google.com.my|64.233.189.147|:80... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [text/html] Saving to: `www.google.com.my/index.html' [ <=> ] 5,742 --.-K/s in 0.05s 2009-07-19 14:07:27 (102 KB/s) - `www.google.com.my/index.html' saved [5742] FINISHED --2009-07-19 14:07:27-- Downloaded: 1 files, 5.6K in 0.05s (102 KB/s) Converting www.google.com.my/index.html... 0-12 Converted 1 files in 0.001 seconds.
Above command will download the “google.com” website into our local drive.
Wget options explanation
-r, –recursive specify recursive download.
-k, –convert-links make links in downloaded HTML point to local files.
-p, –page-requisites get all images, etc. needed to display HTML page.
-E, –html-extension save HTML documents with `.html’ extension.
There still have many useful options in wget , please issue man wget or wget –help to explore more about the other options.
- Java Core Technology - Java RegEx, Java XML, Java I/O, Java Misc
- J2EE Frameworks - Hibernate, Spring 2.5, Spring MVC, Struts 1.x, Struts 2.x
- Build Tools - Maven, Archiva
- Unit Test - jUnit, TestNG
- Client Scripts - jQuery
I think its a really nice post, i like Linux I would add to favs greets Juan