如何在Linux(wget)中下载网站

末蓝、 2023-02-15 05:30 6阅读 0赞

wget是用于在Linux中下载网站的有用命令。 例如, wget [url]

  1. [mkyong@snake ~]$ wget -r -p -k -E http://www.google.com
  2. --2009-07-19 14:07:27-- http://www.google.com/
  3. Resolving www.google.com... 64.233.189.104
  4. Connecting to www.google.com|64.233.189.104|:80... connected.
  5. HTTP request sent, awaiting response... 302 Found
  6. Location: http://www.google.com.my/ [following]
  7. --2009-07-19 14:07:27-- http://www.google.com.my/
  8. Resolving www.google.com.my... 64.233.189.147
  9. Connecting to www.google.com.my|64.233.189.147|:80... connected.
  10. HTTP request sent, awaiting response... 200 OK
  11. Length: unspecified [text/html]
  12. Saving to: `www.google.com.my/index.html'
  13. [ <=> ] 5,742 --.-K/s in 0.05s
  14. 2009-07-19 14:07:27 (102 KB/s) - `www.google.com.my/index.html' saved [5742]
  15. FINISHED --2009-07-19 14:07:27--
  16. Downloaded: 1 files, 5.6K in 0.05s (102 KB/s)
  17. Converting www.google.com.my/index.html... 0-12
  18. Converted 1 files in 0.001 seconds.

上面的命令会将“ google.com”网站下载到我们的本地驱动器中。

Wget选项说明

-r,-recursive指定递归下载。
-k,-convert-links使下载的HTML中的链接指向本地文件。
-p,–page-Requirements获取显示HTML页面所需的所有图像等。
-E,–html-extension保存带有`.html’扩展名的HTML文档。

wget中仍然有许多有用的选项,请发出man wgetwget –help来探索有关其他选项的更多信息。

标签: Unix

翻译自: https://mkyong.com/linux/how-to-download-a-website-in-linux-wget/

发表评论

表情:
评论列表 (有 0 条评论,6人围观)

还没有评论,来说两句吧...

相关阅读

    相关 如何下载网站的图片元素

    如何下载网站中的图片元素呢? 当我们在浏览网站的时候,有时候难免会遇到很想下载的图片,但是那些图片又不仅仅是一张图片,更多地是一个超链接。所以接下来就教大家如何去下载带着