ITPub博客

首页 > Linux操作系统 > Linux操作系统 > rhel4_wget使用详解

rhel4_wget使用详解

原创 Linux操作系统 作者:wisdomone1 时间:2010-03-17 22:01:55 0 删除 编辑
WGET(1)                                                                            GNU Wget                                                                            WGET(1)

NAME
       Wget - The non-interactive network downloader.

SYNOPSIS
       wget [option]... [URL]...

DESCRIPTION
       GNU Wget is a free utility for non-interactive download of files from the Web.  It supports HTTP, HTTPS, and FTP protocols, as well as retrieval through HTTP proxies.

       Wget is non-interactive, meaning that it can work in the background, while the user is not logged on.  This allows you to start a retrieval and disconnect from the
       system, letting Wget finish the work.  By contrast, most of the Web browsers require constant user’s presence, which can be a great hindrance when transferring a lot
       of data.

       Wget can follow links in HTML and XHTML pages and create local versions of remote web sites, fully recreating the directory structure of the original site.  This is
       sometimes referred to as ‘‘recursive downloading.’’  While doing that, Wget respects the Robot Exclusion Standard (/robots.txt).  Wget can be instructed to convert the
       links in downloaded HTML files to the local files for offline viewing.

       Wget has been designed for robustness over slow or unstable network connections; if a download fails due to a network problem, it will keep retrying until the whole
       file has been retrieved.  If the server supports regetting, it will instruct the server to continue the download from where it left off.

OPTIONS
       Option Syntax

       Since Wget uses GNU getopt to process command-line arguments, every option has a long form. along with the short one.  Long options are more convenient to remember, but
       take time to type.  You may freely mix different option styles, or specify options after the command-line arguments.  Thus you may write:

               wget -r --tries=10 http://fly.srk.fer.hr/ -o log

       The space between the option accepting an argument and the argument may be omitted.  Instead -o log you can write -olog.

       You may put several options that do not require arguments together, like:

               wget -drc

       This is a complete equivalent of:

               wget -d -r -c

       Since the options can be specified after the arguments, you may terminate them with --.  So the following will try to download URL -x, reporting failure to log:

               wget -o log -- -x

       The options that accept comma-separated lists all respect the convention that specifying an empty list clears its value.  This can be useful to clear the .wgetrc set-
       tings.  For instance, if your .wgetrc sets "exclude_directories" to /cgi-bin, the following example will first reset it, and then set it to exclude /~nobody and
       /~somebody.  You can also clear the lists in .wgetrc.

               wget -X ’’ -X /~nobody,/~somebody

       Most options that do not accept arguments are boolean options, so named because their state can be captured with a yes-or-no (‘‘boolean’’) variable.  For example,
       --follow-ftp tells Wget to follow FTP links from HTML files and, on the other hand, --no-glob tells it not to perform. file globbing on FTP URLs.  A boolean option is
       either affirmative or negative (beginning with --no).  All such options share several properties.

       Unless stated otherwise, it is assumed that the default behavior. is the opposite of what the option accomplishes.  For example, the documented existence of --fol-
       low-ftp assumes that the default is to not follow FTP links from HTML pages.

       Affirmative options can be negated by prepending the --no- to the option name; negative options can be negated by omitting the --no- prefix.  This might seem superflu-
       ous---if the default for an affirmative option is to not do something, then why provide a way to explicitly turn it off?  But the startup file may in fact change the
       default.  For instance, using "follow_ftp = off" in .wgetrc makes Wget not follow FTP links by default, and using --no-follow-ftp is the only way to restore the fac-
       tory default from the command line.

       Basic Startup Options

       -V
       --version
           Display the version of Wget.

       -h
       --help
           Print a help message describing all of Wget’s command-line options.

       -b
       --background
           Go to background immediately after startup.  If no output file is specified via the -o, output is redirected to wget-log.

       -e command
       --execute command
           Execute command as if it were a part of .wgetrc.  A command thus invoked will be executed after the commands in .wgetrc, thus taking precedence over them.  If you
           need to specify more than one wgetrc command, use multiple instances of -e.

       Logging and Input File Options

       -o logfile
       --output-file=logfile
           Log all messages to logfile.  The messages are normally reported to standard error.

       -a logfile
       --append-output=logfile
           Append to logfile.  This is the same as -o, only it appends to logfile instead of overwriting the old log file.  If logfile does not exist, a new file is created.

       -d
       --debug
           Turn on debug output, meaning various information important to the developers of Wget if it does not work properly.  Your system administrator may have chosen to
           compile Wget without debug support, in which case -d will not work.  Please note that compiling with debug support is always safe---Wget compiled with the debug
           support will not print any debug info unless requested with -d.

       -q
       --quiet
           Turn off Wget’s output.

       -v
       --verbose
           Turn on verbose output, with all the available data.  The default output is verbose.

       -nv
       --no-verbose
           Turn off verbose without being completely quiet (use -q for that), which means that error messages and basic information still get printed.

       -i file
       --input-file=file
           Read URLs from file.  If - is specified as file, URLs are read from the standard input.  (Use ./- to read from a file literally named -.)

           If this function is used, no URLs need be present on the command line.  If there are URLs both on the command line and in an input file, those on the command lines
           will be the first ones to be retrieved.  The file need not be an HTML document (but no harm if it is)---it is enough if the URLs are just listed sequentially.

           However, if you specify --force-html, the document will be regarded as html.  In that case you may have problems with relative links, which you can solve either by
           adding "" to the documents or by specifying --base=url on the command line.

       -F
       --force-html
           When input is read from a file, force it to be treated as an HTML file.  This enables you to retrieve relative links from existing HTML files on your local disk,
           by adding "" to HTML, or using the --base command-line option.

       -B URL
       --base=URL
           Prepends URL to relative links read from the file specified with the -i option.

       Download Options

       --bind-address=ADDRESS
           When making client TCP/IP connections, bind to ADDRESS on the local machine.  ADDRESS may be specified as a hostname or IP address.  This option can be useful if
           your machine is bound to multiple IPs.

       -t number
       --tries=number
           Set number of retries to number.  Specify 0 or inf for infinite retrying.  The default is to retry 20 times, with the exception of fatal errors like ‘‘connection
           refused’’ or ‘‘not found’’ (404), which are not retried.

       -O file
       --output-document=file
           The documents will not be written to the appropriate files, but all will be concatenated together and written to file.  If - is used as file, documents will be
           printed to standard output, disabling link conversion.  (Use ./- to print to a file literally named -.)

           Note that a combination with -k is only well-defined for downloading a single document.

       -nc
       --no-clobber
           If a file is downloaded more than once in the same directory, Wget’s behavior. depends on a few options, including -nc.  In certain cases, the local file will be
           clobbered, or overwritten, upon repeated download.  In other cases it will be preserved.

           When running Wget without -N, -nc, or -r, downloading the same file in the same directory will result in the original copy of file being preserved and the second
           copy being named file.1.  If that file is downloaded yet again, the third copy will be named file.2, and so on.  When -nc is specified, this behavior. is sup-
           pressed, and Wget will refuse to download newer copies of file.  Therefore, ‘‘"no-clobber"’’ is actually a misnomer in this mode---it’s not clobbering that’s pre-
           vented (as the numeric suffixes were already preventing clobbering), but rather the multiple version saving that’s prevented.

           When running Wget with -r, but without -N or -nc, re-downloading a file will result in the new copy simply overwriting the old.  Adding -nc will prevent this
           behavior, instead causing the original version to be preserved and any newer copies on the server to be ignored.

           When running Wget with -N, with or without -r, the decision as to whether or not to download a newer copy of a file depends on the local and remote timestamp and
           size of the file.  -nc may not be specified at the same time as -N.

           Note that when -nc is specified, files with the suffixes .html or .htm will be loaded from the local disk and parsed as if they had been retrieved from the Web.

       -c
       --continue
           Continue getting a partially-downloaded file.  This is useful when you want to finish up a download started by a previous instance of Wget, or by another program.
           For instance:

                   wget -c ftp://sunsite.doc.ic.ac.uk/ls-lR.Z

           If there is a file named ls-lR.Z in the current directory, Wget will assume that it is the first portion of the remote file, and will ask the server to continue
           the retrieval from




另行摘记,中文本地化wget usage

wget的安装与使用

来源: ChinaUnix博客  日期: 2009.07.16 19:59 (共有0条评论) 我要评论
 
安装:
先把下载的wget源文件用tar进行解压,
然后cd到wget目录下
# ./configure
#make
#make install
#make clean
使用:
wget url(要下载的地址)例如:wget http://music.qqihome.shangdu.com/music/15637008169/2009/6/15637008169_200906050942.wma
命令格式:
  wget [参数列表] [目标软件、网页的网址]
  -V,--version 显示软件版本号然后退出;
  -h,--help显示软件帮助信息;
  -e,--execute=COMMAND 执行一个 “.wgetrc”命令
  -o,--output-file=FILE 将软件输出信息保存到文件;
  -a,--append-output=FILE将软件输出信息追加到文件;
  -d,--debug显示输出信息;
  -q,--quiet 不显示输出信息;
  -i,--input-file=FILE 从文件中取得URL;
  -t,--tries=NUMBER 是否下载次数(0表示无穷次)
  -O --output-document=FILE下载文件保存为别的文件名
  -nc, --no-clobber 不要覆盖已经存在的文件
  -N,--timestamping只下载比本地新的文件
  -T,--timeout=SECONDS 设置超时时间
  -Y,--proxy=on/off 关闭代理
    -nd,--no-directories 不建立目录
  -x,--force-directories 强制建立目录
    --http-user=USER设置HTTP用户
  --http-passwd=PASS设置HTTP密码
  --proxy-user=USER设置代理用户
  --proxy-passwd=PASS设置代理密码
    -r,--recursive 下载整个网站、目录
  -l,--level=NUMBER 下载层次
    -A,--accept=LIST 可以接受的文件类型
  -R,--reject=LIST拒绝接受的文件类型
  -D,--domains=LIST可以接受的域名
  --exclude-domains=LIST拒绝的域名
  -L,--relative 下载关联链接
  --follow-ftp 只下载FTP链接
  -H,--span-hosts 可以下载外面的主机
  -I,--include-directories=LIST允许的目录
  -X,--exclude-directories=LIST 拒绝的目录

其它说明:

启动:
-V, --version 显示 Wget 的版本并且退出。
-h, --help 打印此帮助。
-b, -background 启动后进入后台操作。
-e, -execute=COMMAND 运行‘.wgetrc’形式的命令。
日志记录及输入文件:
-o, --output-file=文件 将日志消息写入到指定文件中。
-a, --append-output=文件 将日志消息追加到指定文件的末端。
-d, --debug 打印调试输出。
-q, --quiet 安静模式(不输出信息)。
-v, --verbose 详细输出模式(默认)。
-nv, --non-verbose 关闭详细输出模式,但不进入安静模式。
-i, --input-file=文件 下载从指定文件中找到的 URL。
-F, --force-html 以 HTML 方式处理输入文件。
-B, --base=URL 使用 -F -i 文件选项时,在相对链接前添加指定的 URL 。
下载:
-t, --tries=次数 配置重试次数(0 表示无限)。
--retry-connrefused 即使拒绝连接也重试。
-O --output-document=文件 将数据写入此文件中。
-nc, --no-clobber 不更改已经存在的文件,也不使用在文件名后
添加 .#(# 为数字)的方法写入新的文件。
-c, --continue 继续接收已下载了一部分的文件。
--progress=方式 选择下载进度的表示方式。
-N, --timestamping 除非远程文件较新,否则不再取回。
-S, --server-response 显示服务器回应消息。
--spider 不下载任何数据。
-T, --timeout=秒数 配置读取数据的超时时间 (秒数)。
-w, --wait=秒数 接收不同文件之间等待的秒数。
--waitretry=秒数 在每次重试之间稍等一段时间 (由 1 秒至指定的 秒数 不等)。
--random-wait 接收不同文件之间稍等一段时间(由 0 秒至 2*WAIT 秒不等)。
-Y, --proxy=on/off 打开或关闭代理服务器。
-Q, --quota=大小 配置接收数据的限额大小。
--bind-address=地址 使用本机的指定地址 (主机名称或 IP) 进行连接。
--limit-rate=速率 限制下载的速率。
--dns-cache=off 禁止查找存于高速缓存中的 DNS。
--restrict-file-names=OS 限制文件名中的字符为指定的 OS (操作系统) 所允许 的字符。
目录:
-nd --no-directories 不创建目录。
-x, --force-directories 强制创建目录。
-nH, --no-host-directories 不创建含有远程主机名称的目录。
-P, --directory-prefix=名称 保存文件前先创建指定名称的目录。
--cut-dirs=数目 忽略远程目录中指定数目的目录层。
HTTP 选项:
--http-user=用户 配置 http 用户名。
--http-passwd=密码 配置 http 用户密码。
-C, --cache=on/off (不)使用服务器中的高速缓存中的数据 (默认是使用的)。
-E, --html-extension 将所有 MIME 类型为 text/html 的文件都加上 .html 扩 展文件名。
--ignore-length 忽略“Content-Length”文件头字段。
--header=字符串 在文件头中添加指定字符串。
--proxy-user=用户 配置代理服务器用户名。
--proxy-passwd=密码 配置代理服务器用户密码。
--referer=URL 在 HTTP 请求中包含“Referer:URL”头。
-s, --save-headers 将 HTTP 头存入文件。
-U, --user-agent=AGENT 标志为 AGENT 而不是 Wget/VERSION。
--no-http-keep-alive 禁用 HTTP keep-alive(持久性连接)。
--cookies=off 禁用 cookie。
--load-cookies=文件 会话开始前由指定文件载入 cookie。
--save-cookies=文件 会话结束后将 cookie 保存至指定文件。
--post-data=字符串 使用 POST 方法,发送指定字符串。
--post-file=文件 使用 POST 方法,发送指定文件中的内容。
HTTPS (SSL) 选项:
--sslcertfile=文件 可选的客户段端证书。
--sslcertkey=密钥文件 对此证书可选的“密钥文件”。
--egd-file=文件 EGD socket 文件名。
--sslcadir=目录 CA 散列表所在的目录。
--sslcafile=文件 包含 CA 的文件。
--sslcerttype=0/1 Client-Cert 类型 0=PEM (默认) / 1=ASN1 (DER)
--sslcheckcert=0/1 根据提供的 CA 检查服务器的证书
--sslprotocol=0-3 选择 SSL 协议;0=自动选择,
1=SSLv2 2=SSLv3 3=TLSv1
FTP 选项:
-nr, --dont-remove-listing 不删除“.listing”文件。
-g, --glob=on/off 设置是否展开有通配符的文件名。
--passive-ftp 使用“被动”传输模式。
--retr-symlinks 在递归模式中,下载链接所指示的文件(连至目录
则例外)。
递归下载:
-r, --recursive 递归下载。
-l, --level=数字 最大递归深度(inf 或 0 表示无限)。
--delete-after 删除下载后的文件。
-k, --convert-links 将绝对链接转换为相对链接。
-K, --backup-converted 转换文件 X 前先将其备份为 X.orig。
-m, --mirror 等效于 -r -N -l inf -nr 的选项。
-p, --page-requisites 下载所有显示完整网页所需的文件,例如图像。
--strict-comments 打开对 HTML 备注的严格(SGML)处理选项。
递归下载时有关接受/拒绝的选项:
-A, --accept=列表 接受的文件样式列表,以逗号分隔。
-R, --reject=列表 排除的文件样式列表,以逗号分隔。
-D, --domains=列表 接受的域列表,以逗号分隔。
--exclude-domains=列表 排除的域列表,以逗号分隔。
--follow-ftp 跟随 HTML 文件中的 FTP 链接。
--follow-tags=列表 要跟随的 HTML 标记,以逗号分隔。
-G, --ignore-tags=列表 要忽略的 HTML 标记,以逗号分隔。
-H, --span-hosts 递归时可进入其它主机。
-L, --relative 只跟随相对链接。
-I, --include-directories=列表 要下载的目录列表。
-X, --exclude-directories=列表 要排除的目录列表。
-np, --no-parent 不搜索上层目录。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9240380/viewspace-629759/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
提供针对oracle初学者及进阶的数据库培训,欢迎大家咨询: 微信: wisdomone 微信公众号: lovedb 工作经历: 中国普天 北京科蓝 北京云和恩墨 北京神州新桥

注册时间:2008-04-04

  • 博文量
    2189
  • 访问量
    12690159