wget

经常看到别人使用wget从网站download文件,一直挺害怕没有用过这个工具,今天专门了解一下,以后也试试。

首先,看看GNU上对wget的介绍:

GNU Wget is a free software package for retrieving files using HTTP, HTTPS and FTP, the most widely-used Internet protocols. It is a non-interactive commandline tool, so it may easily be called from scripts, cron jobs, terminals without X-Windows support, etc.

GNU Wget是一款通过HTTP,HTTPS和FTP三个最广泛使用的Internet协议来获取文件的免费软件包。这是一个非交互式的命令行工具,所以它可以很方便的在脚本,定时任务,不带X-Windows的终端等环境下使用。

GNU Wget has many features to make retrieving large files or mirroring entire web or FTP sites easy, including:

GNU Wget有许多特性使得下载大文件或者镜像整个web或者FTP站点变得容易,包括:

  • Can resume aborted downloads, using REST and RANGE
  • 可以续传已经中断的下载,使用REST或者RANGE
  • Can use filename wild cards and recursively mirror directories
  • 可以使用文件名通配符和多层目录结构
  • NLS-based message files for many different languages
  • 基于NLS的消息文件可以支持多种不同的语言(NLS是National Language Support吗)
  • Optionally converts absolute links in downloaded documents to relative, so that downloaded documents may link to each other locally
  • 可以自由的转换下载文件中的绝对路径为相对路径,使得下载的文件可以在本地保持相同的目录结构(是在镜像web或者FTP站点时把服务器上的目录结构复制变为本地结构?)
  • Runs on most UNIX-like operating systems as well as Microsoft Windows
  • 可以在多种类UNIX系统例如Windows系统上运行
  • Supports HTTP proxies
  • 支持HTTP代理
  • Supports HTTP cookies
  • 支持HTTP cookies(做什么用?)
  • Supports persistent HTTP connections
  • 支持HTTP长链接?
  • Unattended / background operation
  • 无人值守/后台运行?
  • Uses local file timestamps to determine whether documents need to be re-downloaded when mirroring
  • 检查本地文件时间戳判断是否需要更新镜像站点上的文件
  • GNU Wget is distributed under the GNU General Public License.

介绍看了个大概,也要实际使用一下才能有所体会。我这台机器上没有虚拟机,但是cygwin里面已经下载了wget,很好,先看看帮助都有什么:

选项很多,但常用的应该也就是续传(),接着就试试这个功能:

用wget下载自己的源码包,在33%的时候用Ctrl+C结束下载,然后再使用-c选项继续续传,看第二次wget的输出信息,很明显在计算完已经下载的数据量之后,再接着执行下载的

 

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据