⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wget.1

📁 Wget很好的处理了http和ftp的下载,很值得学习的经典代码
💻 1
📖 第 1 页 / 共 5 页
字号:
administrator may have chosen to compile Wget without debug support, inwhich case \fB\-d\fR will not work.  Please note that compiling withdebug support is always safe\-\-\-Wget compiled with the debug support will\&\fInot\fR print any debug info unless requested with \fB\-d\fR..IP "\fB\-q\fR" 4.IX Item "-q".PD 0.IP "\fB\-\-quiet\fR" 4.IX Item "--quiet".PDTurn off Wget's output..IP "\fB\-v\fR" 4.IX Item "-v".PD 0.IP "\fB\-\-verbose\fR" 4.IX Item "--verbose".PDTurn on verbose output, with all the available data.  The default outputis verbose..IP "\fB\-nv\fR" 4.IX Item "-nv".PD 0.IP "\fB\-\-no\-verbose\fR" 4.IX Item "--no-verbose".PDTurn off verbose without being completely quiet (use \fB\-q\fR forthat), which means that error messages and basic information still getprinted..IP "\fB\-i\fR \fIfile\fR" 4.IX Item "-i file".PD 0.IP "\fB\-\-input\-file=\fR\fIfile\fR" 4.IX Item "--input-file=file".PDRead URLs from \fIfile\fR.  If \fB\-\fR is specified as\&\fIfile\fR, URLs are read from the standard input.  (Use\&\fB./\-\fR to read from a file literally named \fB\-\fR.).SpIf this function is used, no URLs need be present on the commandline.  If there are URLs both on the command line and in an inputfile, those on the command lines will be the first ones to beretrieved.  The \fIfile\fR need not be an \s-1HTML\s0 document (but noharm if it is)\-\-\-it is enough if the URLs are just listedsequentially..SpHowever, if you specify \fB\-\-force\-html\fR, the document will beregarded as \fBhtml\fR.  In that case you may have problems withrelative links, which you can solve either by adding \f(CW\*(C`<basehref="\f(CIurl\f(CW">\*(C'\fR to the documents or by specifying\&\fB\-\-base=\fR\fIurl\fR on the command line..IP "\fB\-F\fR" 4.IX Item "-F".PD 0.IP "\fB\-\-force\-html\fR" 4.IX Item "--force-html".PDWhen input is read from a file, force it to be treated as an \s-1HTML\s0file.  This enables you to retrieve relative links from existing\&\s-1HTML\s0 files on your local disk, by adding \f(CW\*(C`<basehref="\f(CIurl\f(CW">\*(C'\fR to \s-1HTML\s0, or using the \fB\-\-base\fR command-lineoption..IP "\fB\-B\fR \fI\s-1URL\s0\fR" 4.IX Item "-B URL".PD 0.IP "\fB\-\-base=\fR\fI\s-1URL\s0\fR" 4.IX Item "--base=URL".PDPrepends \fI\s-1URL\s0\fR to relative links read from the file specified withthe \fB\-i\fR option..Sh "Download Options".IX Subsection "Download Options".IP "\fB\-\-bind\-address=\fR\fI\s-1ADDRESS\s0\fR" 4.IX Item "--bind-address=ADDRESS"When making client \s-1TCP/IP\s0 connections, bind to \fI\s-1ADDRESS\s0\fR onthe local machine.  \fI\s-1ADDRESS\s0\fR may be specified as a hostname or \s-1IP\s0address.  This option can be useful if your machine is bound to multipleIPs..IP "\fB\-t\fR \fInumber\fR" 4.IX Item "-t number".PD 0.IP "\fB\-\-tries=\fR\fInumber\fR" 4.IX Item "--tries=number".PDSet number of retries to \fInumber\fR.  Specify 0 or \fBinf\fR forinfinite retrying.  The default is to retry 20 times, with the exceptionof fatal errors like \*(L"connection refused\*(R" or \*(L"not found\*(R" (404),which are not retried..IP "\fB\-O\fR \fIfile\fR" 4.IX Item "-O file".PD 0.IP "\fB\-\-output\-document=\fR\fIfile\fR" 4.IX Item "--output-document=file".PDThe documents will not be written to the appropriate files, but allwill be concatenated together and written to \fIfile\fR.  If \fB\-\fRis used as \fIfile\fR, documents will be printed to standard output,disabling link conversion.  (Use \fB./\-\fR to print to a fileliterally named \fB\-\fR.).SpUse of \fB\-O\fR is \fInot\fR intended to mean simply "use the name\&\fIfile\fR instead of the one in the \s-1URL\s0;" rather, it isanalogous to shell redirection:\&\fBwget \-O file http://foo\fR is intended to work like\&\fBwget \-O \- http://foo > file\fR; \fIfile\fR will be truncatedimmediately, and \fIall\fR downloaded content will be written there..SpNote that a combination with \fB\-k\fR is only permitted whendownloading a single document, and combination with any of \fB\-r\fR,\&\fB\-p\fR, or \fB\-N\fR is not allowed..IP "\fB\-nc\fR" 4.IX Item "-nc".PD 0.IP "\fB\-\-no\-clobber\fR" 4.IX Item "--no-clobber".PDIf a file is downloaded more than once in the same directory, Wget'sbehavior depends on a few options, including \fB\-nc\fR.  In certaincases, the local file will be \fIclobbered\fR, or overwritten, uponrepeated download.  In other cases it will be preserved..SpWhen running Wget without \fB\-N\fR, \fB\-nc\fR, \fB\-r\fR, or \fBp\fR,downloading the same file in the same directory will result in theoriginal copy of \fIfile\fR being preserved and the second copy beingnamed \fIfile\fR\fB.1\fR.  If that file is downloaded yet again, thethird copy will be named \fIfile\fR\fB.2\fR, and so on.  When\&\fB\-nc\fR is specified, this behavior is suppressed, and Wget willrefuse to download newer copies of \fIfile\fR.  Therefore,"\f(CW\*(C`no\-clobber\*(C'\fR" is actually a misnomer in this mode\-\-\-it's notclobbering that's prevented (as the numeric suffixes were alreadypreventing clobbering), but rather the multiple version saving that'sprevented..SpWhen running Wget with \fB\-r\fR or \fB\-p\fR, but without \fB\-N\fRor \fB\-nc\fR, re-downloading a file will result in the new copysimply overwriting the old.  Adding \fB\-nc\fR will prevent thisbehavior, instead causing the original version to be preserved and anynewer copies on the server to be ignored..SpWhen running Wget with \fB\-N\fR, with or without \fB\-r\fR or\&\fB\-p\fR, the decision as to whether or not to download a newer copyof a file depends on the local and remote timestamp and size of thefile.  \fB\-nc\fR may not be specified at thesame time as \fB\-N\fR..SpNote that when \fB\-nc\fR is specified, files with the suffixes\&\fB.html\fR or \fB.htm\fR will be loaded from the local disk andparsed as if they had been retrieved from the Web..IP "\fB\-c\fR" 4.IX Item "-c".PD 0.IP "\fB\-\-continue\fR" 4.IX Item "--continue".PDContinue getting a partially-downloaded file.  This is useful when youwant to finish up a download started by a previous instance of Wget, orby another program.  For instance:.Sp.Vb 1\&        wget -c ftp://sunsite.doc.ic.ac.uk/ls-lR.Z.Ve.SpIf there is a file named \fIls\-lR.Z\fR in the current directory, Wgetwill assume that it is the first portion of the remote file, and willask the server to continue the retrieval from an offset equal to thelength of the local file..SpNote that you don't need to specify this option if you just want thecurrent invocation of Wget to retry downloading a file should theconnection be lost midway through.  This is the default behavior.\&\fB\-c\fR only affects resumption of downloads started \fIprior\fR tothis invocation of Wget, and whose local files are still sitting around..SpWithout \fB\-c\fR, the previous example would just download the remotefile to \fIls\-lR.Z.1\fR, leaving the truncated \fIls\-lR.Z\fR filealone..SpBeginning with Wget 1.7, if you use \fB\-c\fR on a non-empty file, andit turns out that the server does not support continued downloading,Wget will refuse to start the download from scratch, which wouldeffectively ruin existing contents.  If you really want the download tostart from scratch, remove the file..SpAlso beginning with Wget 1.7, if you use \fB\-c\fR on a file which is ofequal size as the one on the server, Wget will refuse to download thefile and print an explanatory message.  The same happens when the fileis smaller on the server than locally (presumably because it was changedon the server since your last download attempt)\-\-\-because \*(L"continuing\*(R"is not meaningful, no download occurs..SpOn the other side of the coin, while using \fB\-c\fR, any file that'sbigger on the server than locally will be considered an incompletedownload and only \f(CW\*(C`(length(remote) \- length(local))\*(C'\fR bytes will bedownloaded and tacked onto the end of the local file.  This behavior canbe desirable in certain cases\-\-\-for instance, you can use \fBwget \-c\fRto download just the new portion that's been appended to a datacollection or log file..SpHowever, if the file is bigger on the server because it's been\&\fIchanged\fR, as opposed to just \fIappended\fR to, you'll end upwith a garbled file.  Wget has no way of verifying that the local fileis really a valid prefix of the remote file.  You need to be especiallycareful of this when using \fB\-c\fR in conjunction with \fB\-r\fR,since every file will be considered as an \*(L"incomplete download\*(R" candidate..SpAnother instance where you'll get a garbled file if you try to use\&\fB\-c\fR is if you have a lame \s-1HTTP\s0 proxy that inserts a\&\*(L"transfer interrupted\*(R" string into the local file.  In the future a\&\*(L"rollback\*(R" option may be added to deal with this case..SpNote that \fB\-c\fR only works with \s-1FTP\s0 servers and with \s-1HTTP\s0servers that support the \f(CW\*(C`Range\*(C'\fR header..IP "\fB\-\-progress=\fR\fItype\fR" 4.IX Item "--progress=type"Select the type of the progress indicator you wish to use.  Legalindicators are \*(L"dot\*(R" and \*(L"bar\*(R"..SpThe \*(L"bar\*(R" indicator is used by default.  It draws an \s-1ASCII\s0 progressbar graphics (a.k.a \*(L"thermometer\*(R" display) indicating the status ofretrieval.  If the output is not a \s-1TTY\s0, the \*(L"dot\*(R" bar will be used bydefault..SpUse \fB\-\-progress=dot\fR to switch to the \*(L"dot\*(R" display.  It tracesthe retrieval by printing dots on the screen, each dot representing afixed amount of downloaded data..SpWhen using the dotted retrieval, you may also set the \fIstyle\fR byspecifying the type as \fBdot:\fR\fIstyle\fR.  Different styles assigndifferent meaning to one dot.  With the \f(CW\*(C`default\*(C'\fR style each dotrepresents 1K, there are ten dots in a cluster and 50 dots in a line.The \f(CW\*(C`binary\*(C'\fR style has a more \*(L"computer\*(R"\-like orientation\-\-\-8Kdots, 16\-dots clusters and 48 dots per line (which makes for 384Klines).  The \f(CW\*(C`mega\*(C'\fR style is suitable for downloading very largefiles\-\-\-each dot represents 64K retrieved, there are eight dots in acluster, and 48 dots on each line (so each line contains 3M)..SpNote that you can set the default style using the \f(CW\*(C`progress\*(C'\fRcommand in \fI.wgetrc\fR.  That setting may be overridden from thecommand line.  The exception is that, when the output is not a \s-1TTY\s0, the\&\*(L"dot\*(R" progress will be favored over \*(L"bar\*(R".  To force the bar output,use \fB\-\-progress=bar:force\fR..IP "\fB\-N\fR" 4.IX Item "-N".PD 0.IP "\fB\-\-timestamping\fR" 4.IX Item "--timestamping".PDTurn on time\-stamping.  .IP "\fB\-S\fR" 4.IX Item "-S".PD 0.IP "\fB\-\-server\-response\fR" 4.IX Item "--server-response".PDPrint the headers sent by \s-1HTTP\s0 servers and responses sent by\&\s-1FTP\s0 servers..IP "\fB\-\-spider\fR" 4.IX Item "--spider"When invoked with this option, Wget will behave as a Web \fIspider\fR,which means that it will not download the pages, just check that theyare there.  For example, you can use Wget to check your bookmarks:.Sp.Vb 1\&        wget --spider --force-html -i bookmarks.html.Ve.SpThis feature needs much more work for Wget to get close to thefunctionality of real web spiders..IP "\fB\-T seconds\fR" 4.IX Item "-T seconds".PD 0.IP "\fB\-\-timeout=\fR\fIseconds\fR" 4.IX Item "--timeout=seconds".PDSet the network timeout to \fIseconds\fR seconds.  This is equivalentto specifying \fB\-\-dns\-timeout\fR, \fB\-\-connect\-timeout\fR, and\&\fB\-\-read\-timeout\fR, all at the same time..SpWhen interacting with the network, Wget can check for timeout andabort the operation if it takes too long.  This prevents anomalieslike hanging reads and infinite connects.  The only timeout enabled bydefault is a 900\-second read timeout.  Setting a timeout to 0 disablesit altogether.  Unless you know what you are doing, it is best not tochange the default timeout settings..SpAll timeout-related options accept decimal values, as well assubsecond values.  For example, \fB0.1\fR seconds is a legal (thoughunwise) choice of timeout.  Subsecond timeouts are useful for checkingserver response times or for testing network latency..IP "\fB\-\-dns\-timeout=\fR\fIseconds\fR" 4.IX Item "--dns-timeout=seconds"Set the \s-1DNS\s0 lookup timeout to \fIseconds\fR seconds.  \s-1DNS\s0 lookups thatdon't complete within the specified time will fail.  By default, thereis no timeout on \s-1DNS\s0 lookups, other than that implemented by systemlibraries..IP "\fB\-\-connect\-timeout=\fR\fIseconds\fR" 4

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -