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

📄 wget.1

📁 Wget很好的处理了http和ftp的下载,很值得学习的经典代码
💻 1
📖 第 1 页 / 共 5 页
字号:
downloaded file should be..IP "\fB\-\-auth\-no\-challenge\fR" 4.IX Item "--auth-no-challenge"If this option is given, Wget will send Basic \s-1HTTP\s0 authenticationinformation (plaintext username and password) for all requests, justlike Wget 1.10.2 and prior did by default..SpUse of this option is not recommended, and is intended only to supportsome few obscure servers, which never send \s-1HTTP\s0 authenticationchallenges, but accept unsolicited auth info, say, in addition toform-based authentication..Sh "\s-1HTTPS\s0 (\s-1SSL/TLS\s0) Options".IX Subsection "HTTPS (SSL/TLS) Options"To support encrypted \s-1HTTP\s0 (\s-1HTTPS\s0) downloads, Wget must be compiledwith an external \s-1SSL\s0 library, currently OpenSSL.  If Wget is compiledwithout \s-1SSL\s0 support, none of these options are available..IP "\fB\-\-secure\-protocol=\fR\fIprotocol\fR" 4.IX Item "--secure-protocol=protocol"Choose the secure protocol to be used.  Legal values are \fBauto\fR,\&\fBSSLv2\fR, \fBSSLv3\fR, and \fBTLSv1\fR.  If \fBauto\fR is used,the \s-1SSL\s0 library is given the liberty of choosing the appropriateprotocol automatically, which is achieved by sending an SSLv2 greetingand announcing support for SSLv3 and TLSv1.  This is the default..SpSpecifying \fBSSLv2\fR, \fBSSLv3\fR, or \fBTLSv1\fR forces the useof the corresponding protocol.  This is useful when talking to old andbuggy \s-1SSL\s0 server implementations that make it hard for OpenSSL tochoose the correct protocol version.  Fortunately, such servers arequite rare..IP "\fB\-\-no\-check\-certificate\fR" 4.IX Item "--no-check-certificate"Don't check the server certificate against the available certificateauthorities.  Also don't require the \s-1URL\s0 host name to match the commonname presented by the certificate..SpAs of Wget 1.10, the default is to verify the server's certificateagainst the recognized certificate authorities, breaking the \s-1SSL\s0handshake and aborting the download if the verification fails.Although this provides more secure downloads, it does breakinteroperability with some sites that worked with previous Wgetversions, particularly those using self\-signed, expired, or otherwiseinvalid certificates.  This option forces an \*(L"insecure\*(R" mode ofoperation that turns the certificate verification errors into warningsand allows you to proceed..SpIf you encounter \*(L"certificate verification\*(R" errors or ones sayingthat \*(L"common name doesn't match requested host name\*(R", you can usethis option to bypass the verification and proceed with the download.\&\fIOnly use this option if you are otherwise convinced of thesite's authenticity, or if you really don't care about the validity ofits certificate.\fR  It is almost always a bad idea not to check thecertificates when transmitting confidential or important data..IP "\fB\-\-certificate=\fR\fIfile\fR" 4.IX Item "--certificate=file"Use the client certificate stored in \fIfile\fR.  This is needed forservers that are configured to require certificates from the clientsthat connect to them.  Normally a certificate is not required and thisswitch is optional..IP "\fB\-\-certificate\-type=\fR\fItype\fR" 4.IX Item "--certificate-type=type"Specify the type of the client certificate.  Legal values are\&\fB\s-1PEM\s0\fR (assumed by default) and \fB\s-1DER\s0\fR, also known as\&\fB\s-1ASN1\s0\fR..IP "\fB\-\-private\-key=\fR\fIfile\fR" 4.IX Item "--private-key=file"Read the private key from \fIfile\fR.  This allows you to provide theprivate key in a file separate from the certificate..IP "\fB\-\-private\-key\-type=\fR\fItype\fR" 4.IX Item "--private-key-type=type"Specify the type of the private key.  Accepted values are \fB\s-1PEM\s0\fR(the default) and \fB\s-1DER\s0\fR..IP "\fB\-\-ca\-certificate=\fR\fIfile\fR" 4.IX Item "--ca-certificate=file"Use \fIfile\fR as the file with the bundle of certificate authorities(\*(L"\s-1CA\s0\*(R") to verify the peers.  The certificates must be in \s-1PEM\s0 format..SpWithout this option Wget looks for \s-1CA\s0 certificates at thesystem-specified locations, chosen at OpenSSL installation time..IP "\fB\-\-ca\-directory=\fR\fIdirectory\fR" 4.IX Item "--ca-directory=directory"Specifies directory containing \s-1CA\s0 certificates in \s-1PEM\s0 format.  Eachfile contains one \s-1CA\s0 certificate, and the file name is based on a hashvalue derived from the certificate.  This is achieved by processing acertificate directory with the \f(CW\*(C`c_rehash\*(C'\fR utility supplied withOpenSSL.  Using \fB\-\-ca\-directory\fR is more efficient than\&\fB\-\-ca\-certificate\fR when many certificates are installed becauseit allows Wget to fetch certificates on demand..SpWithout this option Wget looks for \s-1CA\s0 certificates at thesystem-specified locations, chosen at OpenSSL installation time..IP "\fB\-\-random\-file=\fR\fIfile\fR" 4.IX Item "--random-file=file"Use \fIfile\fR as the source of random data for seeding thepseudo-random number generator on systems without \fI/dev/random\fR..SpOn such systems the \s-1SSL\s0 library needs an external source of randomnessto initialize.  Randomness may be provided by \s-1EGD\s0 (see\&\fB\-\-egd\-file\fR below) or read from an external source specified bythe user.  If this option is not specified, Wget looks for random datain \f(CW$RANDFILE\fR or, if that is unset, in \fI$HOME/.rnd\fR.  Ifnone of those are available, it is likely that \s-1SSL\s0 encryption will notbe usable..SpIf you're getting the \*(L"Could not seed OpenSSL \s-1PRNG\s0; disabling \s-1SSL\s0.\*(R" error, you should provide random data using some of the methodsdescribed above..IP "\fB\-\-egd\-file=\fR\fIfile\fR" 4.IX Item "--egd-file=file"Use \fIfile\fR as the \s-1EGD\s0 socket.  \s-1EGD\s0 stands for \fIEntropyGathering Daemon\fR, a user-space program that collects data fromvarious unpredictable system sources and makes it available to otherprograms that might need it.  Encryption software, such as the \s-1SSL\s0library, needs sources of non-repeating randomness to seed the randomnumber generator used to produce cryptographically strong keys..SpOpenSSL allows the user to specify his own source of entropy using the\&\f(CW\*(C`RAND_FILE\*(C'\fR environment variable.  If this variable is unset, orif the specified file does not produce enough randomness, OpenSSL willread random data from \s-1EGD\s0 socket specified using this option..SpIf this option is not specified (and the equivalent startup command isnot used), \s-1EGD\s0 is never contacted.  \s-1EGD\s0 is not needed on modern Unixsystems that support \fI/dev/random\fR..Sh "\s-1FTP\s0 Options".IX Subsection "FTP Options".IP "\fB\-\-ftp\-user=\fR\fIuser\fR" 4.IX Item "--ftp-user=user".PD 0.IP "\fB\-\-ftp\-password=\fR\fIpassword\fR" 4.IX Item "--ftp-password=password".PDSpecify the username \fIuser\fR and password \fIpassword\fR on an\&\s-1FTP\s0 server.  Without this, or the corresponding startup option, the password defaults to \fB\-wget@\fR, normally used for anonymous \&\s-1FTP\s0..SpAnother way to specify username and password is in the \s-1URL\s0 itself.  Either method reveals your password to anyone whobothers to run \f(CW\*(C`ps\*(C'\fR.  To prevent the passwords from being seen,store them in \fI.wgetrc\fR or \fI.netrc\fR, and make sure to protectthose files from other users with \f(CW\*(C`chmod\*(C'\fR.  If the passwords arereally important, do not leave them lying in those files either\-\-\-editthe files and delete them after Wget has started the download..IP "\fB\-\-no\-remove\-listing\fR" 4.IX Item "--no-remove-listing"Don't remove the temporary \fI.listing\fR files generated by \s-1FTP\s0retrievals.  Normally, these files contain the raw directory listingsreceived from \s-1FTP\s0 servers.  Not removing them can be useful fordebugging purposes, or when you want to be able to easily check on thecontents of remote server directories (e.g. to verify that a mirroryou're running is complete)..SpNote that even though Wget writes to a known filename for this file,this is not a security hole in the scenario of a user making\&\fI.listing\fR a symbolic link to \fI/etc/passwd\fR or something andasking \f(CW\*(C`root\*(C'\fR to run Wget in his or her directory.  Depending onthe options used, either Wget will refuse to write to \fI.listing\fR,making the globbing/recursion/time\-stamping operation fail, or thesymbolic link will be deleted and replaced with the actual\&\fI.listing\fR file, or the listing will be written to a\&\fI.listing.\fInumber\fI\fR file..SpEven though this situation isn't a problem, though, \f(CW\*(C`root\*(C'\fR shouldnever run Wget in a non-trusted user's directory.  A user could dosomething as simple as linking \fIindex.html\fR to \fI/etc/passwd\fRand asking \f(CW\*(C`root\*(C'\fR to run Wget with \fB\-N\fR or \fB\-r\fR so the filewill be overwritten..IP "\fB\-\-no\-glob\fR" 4.IX Item "--no-glob"Turn off \s-1FTP\s0 globbing.  Globbing refers to the use of shell-likespecial characters (\fIwildcards\fR), like \fB*\fR, \fB?\fR, \fB[\fRand \fB]\fR to retrieve more than one file from the same directory atonce, like:.Sp.Vb 1\&        wget ftp://gnjilux.srk.fer.hr/*.msg.Ve.SpBy default, globbing will be turned on if the \s-1URL\s0 contains aglobbing character.  This option may be used to turn globbing on or offpermanently..SpYou may have to quote the \s-1URL\s0 to protect it from being expanded byyour shell.  Globbing makes Wget look for a directory listing, which issystem\-specific.  This is why it currently works only with Unix \s-1FTP\s0servers (and the ones emulating Unix \f(CW\*(C`ls\*(C'\fR output)..IP "\fB\-\-no\-passive\-ftp\fR" 4.IX Item "--no-passive-ftp"Disable the use of the \fIpassive\fR \s-1FTP\s0 transfer mode.  Passive \s-1FTP\s0mandates that the client connect to the server to establish the dataconnection rather than the other way around..SpIf the machine is connected to the Internet directly, both passive andactive \s-1FTP\s0 should work equally well.  Behind most firewall and \s-1NAT\s0configurations passive \s-1FTP\s0 has a better chance of working.  However,in some rare firewall configurations, active \s-1FTP\s0 actually works whenpassive \s-1FTP\s0 doesn't.  If you suspect this to be the case, use thisoption, or set \f(CW\*(C`passive_ftp=off\*(C'\fR in your init file..IP "\fB\-\-retr\-symlinks\fR" 4.IX Item "--retr-symlinks"Usually, when retrieving \s-1FTP\s0 directories recursively and a symboliclink is encountered, the linked-to file is not downloaded.  Instead, amatching symbolic link is created on the local filesystem.  Thepointed-to file will not be downloaded unless this recursive retrievalwould have encountered it separately and downloaded it anyway..SpWhen \fB\-\-retr\-symlinks\fR is specified, however, symbolic links aretraversed and the pointed-to files are retrieved.  At this time, thisoption does not cause Wget to traverse symlinks to directories andrecurse through them, but in the future it should be enhanced to dothis..SpNote that when retrieving a file (not a directory) because it wasspecified on the command\-line, rather than because it was recursed to,this option has no effect.  Symbolic links are always traversed in thiscase..IP "\fB\-\-no\-http\-keep\-alive\fR" 4.IX Item "--no-http-keep-alive"Turn off the \*(L"keep\-alive\*(R" feature for \s-1HTTP\s0 downloads.  Normally, Wgetasks the server to keep the connection open so that, when you downloadmore than one document from the same server, they get transferred overthe same \s-1TCP\s0 connection.  This saves time and at the same time reducesthe load on the server..SpThis option is useful when, for some reason, persistent (keep\-alive)connections don't work for you, for example due to a server bug or dueto the inability of server-side scripts to cope with the connections..Sh "Recursive Retrieval Options".IX Subsection "Recursive Retrieval Options".IP "\fB\-r\fR" 4.IX Item "-r".PD 0.IP "\fB\-\-recursive\fR" 4.IX Item "--recursive".PDTurn on recursive retrieving.  .IP "\fB\-l\fR \fIdepth\fR" 4.IX Item "-l depth".PD 0.IP "\fB\-\-level=\fR\fIdepth\fR" 4.IX Item "--level=depth".PDSpecify recursion maximum depth level \fIdepth\fR.  The default maximum depth is 5..IP "\fB\-\-delete\-after\fR" 4.IX Item "--delete-after"This option tells Wget to delete every single file it downloads,\&\fIafter\fR having done so.  It is useful for pre-fetching popularpages through a proxy, e.g.:.Sp.Vb 1\&        wget -r -nd --delete-after http://whatever.com/~popular/page/.Ve.SpThe \fB\-r\fR option is to retrieve recursively, and \fB\-nd\fR to notcreate directories.  .SpNote that \fB\-\-delete\-after\fR deletes files on the local machine.  Itdoes not issue the \fB\s-1DELE\s0\fR command to remote \s-1FTP\s0 sites, forinstance.  Also note that when \fB\-\-delete\-after\fR is specified,\&\fB\-\-convert\-links\fR is ignored, so \fB.orig\fR files are simply notcreated in the first place..IP "\fB\-k\fR" 4.IX Item "-k".PD 0.IP "\fB\-\-convert\-links\fR" 4.IX Item "--convert-links".PDAfter the download is complete, convert the links in the document tomake them suitable for local viewing.  This affects not only the visiblehyperlinks, but any part of the document that links to external content,such as embedded images, links to style sheets, hyperlinks to non-HTMLcontent, etc..SpEach link will be changed in one of the two ways:.RS 4.IP "*" 4The links to files that have been downloaded by Wget will be changed torefer to the file they point to as a relative link..SpExample: if the downloaded file \fI/foo/doc.html\fR links to\&\fI/bar/img.gif\fR, also downloaded, then the link in \fIdoc.html\fRwill be modified to point to \fB../bar/img.gif\fR.  This kind oftransformation works reliably for arbitrary combinations of directories..IP "*" 4The links to files that have not been downloaded by Wget will be changedto include host name and absolute path of the location they point to..SpExample: if the downloaded file \fI/foo/doc.html\fR links to\&\fI/bar/img.gif\fR (or to \fI../bar/img.gif\fR), then the link in\&\fIdoc.html\fR will be modified to point to\&\fIhttp://\fIhostname\fI/bar/img.gif\fR.

⌨️ 快捷键说明

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