📄 wget.1
字号:
.IX Item "--connect-timeout=seconds"Set the connect timeout to \fIseconds\fR seconds. \s-1TCP\s0 connections thattake longer to establish will be aborted. By default, there is noconnect timeout, other than that implemented by system libraries..IP "\fB\-\-read\-timeout=\fR\fIseconds\fR" 4.IX Item "--read-timeout=seconds"Set the read (and write) timeout to \fIseconds\fR seconds. The\&\*(L"time\*(R" of this timeout refers to \fIidle time\fR: if, at any point inthe download, no data is received for more than the specified numberof seconds, reading fails and the download is restarted. This optiondoes not directly affect the duration of the entire download..SpOf course, the remote server may choose to terminate the connectionsooner than this option requires. The default read timeout is 900seconds..IP "\fB\-\-limit\-rate=\fR\fIamount\fR" 4.IX Item "--limit-rate=amount"Limit the download speed to \fIamount\fR bytes per second. Amount maybe expressed in bytes, kilobytes with the \fBk\fR suffix, or megabyteswith the \fBm\fR suffix. For example, \fB\-\-limit\-rate=20k\fR willlimit the retrieval rate to 20KB/s. This is useful when, for whateverreason, you don't want Wget to consume the entire available bandwidth..SpThis option allows the use of decimal numbers, usually in conjunctionwith power suffixes; for example, \fB\-\-limit\-rate=2.5k\fR is a legalvalue..SpNote that Wget implements the limiting by sleeping the appropriateamount of time after a network read that took less time than specifiedby the rate. Eventually this strategy causes the \s-1TCP\s0 transfer to slowdown to approximately the specified rate. However, it may take sometime for this balance to be achieved, so don't be surprised if limitingthe rate doesn't work well with very small files..IP "\fB\-w\fR \fIseconds\fR" 4.IX Item "-w seconds".PD 0.IP "\fB\-\-wait=\fR\fIseconds\fR" 4.IX Item "--wait=seconds".PDWait the specified number of seconds between the retrievals. Use ofthis option is recommended, as it lightens the server load by making therequests less frequent. Instead of in seconds, the time can bespecified in minutes using the \f(CW\*(C`m\*(C'\fR suffix, in hours using \f(CW\*(C`h\*(C'\fRsuffix, or in days using \f(CW\*(C`d\*(C'\fR suffix..SpSpecifying a large value for this option is useful if the network or thedestination host is down, so that Wget can wait long enough toreasonably expect the network error to be fixed before the retry. Thewaiting interval specified by this function is influenced by\&\f(CW\*(C`\-\-random\-wait\*(C'\fR, which see..IP "\fB\-\-waitretry=\fR\fIseconds\fR" 4.IX Item "--waitretry=seconds"If you don't want Wget to wait between \fIevery\fR retrieval, but onlybetween retries of failed downloads, you can use this option. Wget willuse \fIlinear backoff\fR, waiting 1 second after the first failure on agiven file, then waiting 2 seconds after the second failure on thatfile, up to the maximum number of \fIseconds\fR you specify. Therefore,a value of 10 will actually make Wget wait up to (1 + 2 + ... + 10) = 55seconds per file..SpNote that this option is turned on by default in the global\&\fIwgetrc\fR file..IP "\fB\-\-random\-wait\fR" 4.IX Item "--random-wait"Some web sites may perform log analysis to identify retrieval programssuch as Wget by looking for statistically significant similarities inthe time between requests. This option causes the time between requeststo vary between 0.5 and 1.5 * \fIwait\fR seconds, where \fIwait\fR wasspecified using the \fB\-\-wait\fR option, in order to mask Wget'spresence from such analysis..SpA 2001 article in a publication devoted to development on a popularconsumer platform provided code to perform this analysis on the fly.Its author suggested blocking at the class C address level to ensureautomated retrieval programs were blocked despite changing DHCP-suppliedaddresses..SpThe \fB\-\-random\-wait\fR option was inspired by this ill-advisedrecommendation to block many unrelated users from a web site due to theactions of one..IP "\fB\-\-no\-proxy\fR" 4.IX Item "--no-proxy"Don't use proxies, even if the appropriate \f(CW*_proxy\fR environmentvariable is defined..IP "\fB\-Q\fR \fIquota\fR" 4.IX Item "-Q quota".PD 0.IP "\fB\-\-quota=\fR\fIquota\fR" 4.IX Item "--quota=quota".PDSpecify download quota for automatic retrievals. The value can bespecified in bytes (default), kilobytes (with \fBk\fR suffix), ormegabytes (with \fBm\fR suffix)..SpNote that quota will never affect downloading a single file. So if youspecify \fBwget \-Q10k ftp://wuarchive.wustl.edu/ls\-lR.gz\fR, all of the\&\fIls\-lR.gz\fR will be downloaded. The same goes even when severalURLs are specified on the command\-line. However, quota isrespected when retrieving either recursively, or from an input file.Thus you may safely type \fBwget \-Q2m \-i sites\fR\-\-\-download will beaborted when the quota is exceeded..SpSetting quota to 0 or to \fBinf\fR unlimits the download quota..IP "\fB\-\-no\-dns\-cache\fR" 4.IX Item "--no-dns-cache"Turn off caching of \s-1DNS\s0 lookups. Normally, Wget remembers the \s-1IP\s0addresses it looked up from \s-1DNS\s0 so it doesn't have to repeatedlycontact the \s-1DNS\s0 server for the same (typically small) set of hosts itretrieves from. This cache exists in memory only; a new Wget run willcontact \s-1DNS\s0 again..SpHowever, it has been reported that in some situations it is notdesirable to cache host names, even for the duration of ashort-running application like Wget. With this option Wget issues anew \s-1DNS\s0 lookup (more precisely, a new call to \f(CW\*(C`gethostbyname\*(C'\fR or\&\f(CW\*(C`getaddrinfo\*(C'\fR) each time it makes a new connection. Please notethat this option will \fInot\fR affect caching that might beperformed by the resolving library or by an external caching layer,such as \s-1NSCD\s0..SpIf you don't understand exactly what this option does, you probablywon't need it..IP "\fB\-\-restrict\-file\-names=\fR\fImode\fR" 4.IX Item "--restrict-file-names=mode"Change which characters found in remote URLs may show up in local filenames generated from those URLs. Characters that are \fIrestricted\fRby this option are escaped, i.e. replaced with \fB%HH\fR, where\&\fB\s-1HH\s0\fR is the hexadecimal number that corresponds to the restrictedcharacter..SpBy default, Wget escapes the characters that are not valid as part offile names on your operating system, as well as control characters thatare typically unprintable. This option is useful for changing thesedefaults, either because you are downloading to a non-native partition,or because you want to disable escaping of the control characters..SpWhen mode is set to \*(L"unix\*(R", Wget escapes the character \fB/\fR andthe control characters in the ranges 0\-\-31 and 128\-\-159. This is thedefault on Unix-like \s-1OS\s0'es..SpWhen mode is set to \*(L"windows\*(R", Wget escapes the characters \fB\e\fR,\&\fB|\fR, \fB/\fR, \fB:\fR, \fB?\fR, \fB"\fR, \fB*\fR, \fB<\fR,\&\fB>\fR, and the control characters in the ranges 0\-\-31 and 128\-\-159.In addition to this, Wget in Windows mode uses \fB+\fR instead of\&\fB:\fR to separate host and port in local file names, and uses\&\fB@\fR instead of \fB?\fR to separate the query portion of the filename from the rest. Therefore, a \s-1URL\s0 that would be saved as\&\fBwww.xemacs.org:4300/search.pl?input=blah\fR in Unix mode would besaved as \fBwww.xemacs.org+4300/search.pl@input=blah\fR in Windowsmode. This mode is the default on Windows..SpIf you append \fB,nocontrol\fR to the mode, as in\&\fBunix,nocontrol\fR, escaping of the control characters is alsoswitched off. You can use \fB\-\-restrict\-file\-names=nocontrol\fR toturn off escaping of control characters without affecting the choice ofthe \s-1OS\s0 to use as file name restriction mode..IP "\fB\-4\fR" 4.IX Item "-4".PD 0.IP "\fB\-\-inet4\-only\fR" 4.IX Item "--inet4-only".IP "\fB\-6\fR" 4.IX Item "-6".IP "\fB\-\-inet6\-only\fR" 4.IX Item "--inet6-only".PDForce connecting to IPv4 or IPv6 addresses. With \fB\-\-inet4\-only\fRor \fB\-4\fR, Wget will only connect to IPv4 hosts, ignoring \s-1AAAA\s0records in \s-1DNS\s0, and refusing to connect to IPv6 addresses specified inURLs. Conversely, with \fB\-\-inet6\-only\fR or \fB\-6\fR, Wget willonly connect to IPv6 hosts and ignore A records and IPv4 addresses..SpNeither options should be needed normally. By default, an IPv6\-awareWget will use the address family specified by the host's \s-1DNS\s0 record.If the \s-1DNS\s0 responds with both IPv4 and IPv6 addresses, Wget will trythem in sequence until it finds one it can connect to. (Also see\&\f(CW\*(C`\-\-prefer\-family\*(C'\fR option described below.).SpThese options can be used to deliberately force the use of IPv4 orIPv6 address families on dual family systems, usually to aid debuggingor to deal with broken network configuration. Only one of\&\fB\-\-inet6\-only\fR and \fB\-\-inet4\-only\fR may be specified at thesame time. Neither option is available in Wget compiled without IPv6support..IP "\fB\-\-prefer\-family=IPv4/IPv6/none\fR" 4.IX Item "--prefer-family=IPv4/IPv6/none"When given a choice of several addresses, connect to the addresseswith specified address family first. IPv4 addresses are preferred bydefault..SpThis avoids spurious errors and connect attempts when accessing hoststhat resolve to both IPv6 and IPv4 addresses from IPv4 networks. Forexample, \fBwww.kame.net\fR resolves to\&\fB2001:200:0:8002:203:47ff:fea5:3085\fR and to\&\fB203.178.141.194\fR. When the preferred family is \f(CW\*(C`IPv4\*(C'\fR, theIPv4 address is used first; when the preferred family is \f(CW\*(C`IPv6\*(C'\fR,the IPv6 address is used first; if the specified value is \f(CW\*(C`none\*(C'\fR,the address order returned by \s-1DNS\s0 is used without change..SpUnlike \fB\-4\fR and \fB\-6\fR, this option doesn't inhibit access toany address family, it only changes the \fIorder\fR in which theaddresses are accessed. Also note that the reordering performed bythis option is \fIstable\fR\-\-\-it doesn't affect order of addresses ofthe same family. That is, the relative order of all IPv4 addressesand of all IPv6 addresses remains intact in all cases..IP "\fB\-\-retry\-connrefused\fR" 4.IX Item "--retry-connrefused"Consider \*(L"connection refused\*(R" a transient error and try again.Normally Wget gives up on a \s-1URL\s0 when it is unable to connect to thesite because failure to connect is taken as a sign that the server isnot running at all and that retries would not help. This option isfor mirroring unreliable sites whose servers tend to disappear forshort periods of time..IP "\fB\-\-user=\fR\fIuser\fR" 4.IX Item "--user=user".PD 0.IP "\fB\-\-password=\fR\fIpassword\fR" 4.IX Item "--password=password".PDSpecify the username \fIuser\fR and password \fIpassword\fR for both\&\s-1FTP\s0 and \s-1HTTP\s0 file retrieval. These parameters can be overriddenusing the \fB\-\-ftp\-user\fR and \fB\-\-ftp\-password\fR options for \&\s-1FTP\s0 connections and the \fB\-\-http\-user\fR and \fB\-\-http\-password\fR options for \s-1HTTP\s0 connections..Sh "Directory Options".IX Subsection "Directory Options".IP "\fB\-nd\fR" 4.IX Item "-nd".PD 0.IP "\fB\-\-no\-directories\fR" 4.IX Item "--no-directories".PDDo not create a hierarchy of directories when retrieving recursively.With this option turned on, all files will get saved to the currentdirectory, without clobbering (if a name shows up more than once, thefilenames will get extensions \fB.n\fR)..IP "\fB\-x\fR" 4.IX Item "-x".PD 0.IP "\fB\-\-force\-directories\fR" 4.IX Item "--force-directories".PDThe opposite of \fB\-nd\fR\-\-\-create a hierarchy of directories, even ifone would not have been created otherwise. E.g. \fBwget \-xhttp://fly.srk.fer.hr/robots.txt\fR will save the downloaded file to\&\fIfly.srk.fer.hr/robots.txt\fR..IP "\fB\-nH\fR" 4.IX Item "-nH".PD 0.IP "\fB\-\-no\-host\-directories\fR" 4.IX Item "--no-host-directories".PDDisable generation of host-prefixed directories. By default, invokingWget with \fB\-r http://fly.srk.fer.hr/\fR will create a structure ofdirectories beginning with \fIfly.srk.fer.hr/\fR. This option disablessuch behavior..IP "\fB\-\-protocol\-directories\fR" 4.IX Item "--protocol-directories"Use the protocol name as a directory component of local file names. Forexample, with this option, \fBwget \-r http://\fR\fIhost\fR will save to\&\fBhttp/\fR\fIhost\fR\fB/...\fR rather than just to \fIhost\fR\fB/...\fR..IP "\fB\-\-cut\-dirs=\fR\fInumber\fR" 4.IX Item "--cut-dirs=number"Ignore \fInumber\fR directory components. This is useful for getting afine-grained control over the directory where recursive retrieval willbe saved..SpTake, for example, the directory at\&\fBftp://ftp.xemacs.org/pub/xemacs/\fR. If you retrieve it with\&\fB\-r\fR, it will be saved locally under\&\fIftp.xemacs.org/pub/xemacs/\fR. While the \fB\-nH\fR option canremove the \fIftp.xemacs.org/\fR part, you are still stuck with\&\fIpub/xemacs\fR. This is where \fB\-\-cut\-dirs\fR comes in handy; itmakes Wget not \*(L"see\*(R" \fInumber\fR remote directory components. Hereare several examples of how \fB\-\-cut\-dirs\fR option works..Sp.Vb 4\& No options -> ftp.xemacs.org/pub/xemacs/\& -nH -> pub/xemacs/\& -nH --cut-dirs=1 -> xemacs/\& -nH --cut-dirs=2 -> ..Ve.Sp.Vb 2\& --cut-dirs=1 -> ftp.xemacs.org/xemacs/\& ....Ve.SpIf you just want to get rid of the directory structure, this option issimilar to a combination of \fB\-nd\fR and \fB\-P\fR. However, unlike\&\fB\-nd\fR, \fB\-\-cut\-dirs\fR does not lose with subdirectories\-\-\-forinstance, with \fB\-nH \-\-cut\-dirs=1\fR, a \fIbeta/\fR subdirectory willbe placed to \fIxemacs/beta\fR, as one would expect..IP "\fB\-P\fR \fIprefix\fR" 4.IX Item "-P prefix"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -