WGet使用方法.doc_第1頁(yè)
WGet使用方法.doc_第2頁(yè)
WGet使用方法.doc_第3頁(yè)
WGet使用方法.doc_第4頁(yè)
WGet使用方法.doc_第5頁(yè)
已閱讀5頁(yè),還剩5頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

wget使用方法(ZT)wget是在Linux下開發(fā)的開放源代碼的軟件,作者是Hrvoje Niksic,后來被移植到包括Windows在內(nèi)的各個(gè)平臺(tái)上。它有以下功能和特點(diǎn): (1)支持?jǐn)帱c(diǎn)下傳功能;這一點(diǎn),也是網(wǎng)絡(luò)螞蟻和FlashGet當(dāng)年最大的賣點(diǎn),現(xiàn)在,Wget也可以使用此功能,那些網(wǎng)絡(luò)不是太好的用戶可以放心了; (2)同時(shí)支持FTP和HTTP下載方式;盡管現(xiàn)在大部分軟件可以使用HTTP方式下載,但是,有些時(shí)候仍然需要使用FTP方式下載軟件; (3)支持代理服務(wù)器;對(duì)安全強(qiáng)度很高的系統(tǒng)而言,一般不會(huì)將自己的系統(tǒng)直接暴露在互聯(lián)網(wǎng)上,所以,支持代理是下載軟件必須有的功能; (4)設(shè)置方便簡(jiǎn)單;可能,習(xí)慣圖形界面的用戶已經(jīng)不是太習(xí)慣命令行了,但是,命令行在設(shè)置上其實(shí)有更多的優(yōu)點(diǎn),最少,鼠標(biāo)可以少點(diǎn)很多次,也不要擔(dān)心是否錯(cuò)點(diǎn)鼠標(biāo); (5)程序小完全免費(fèi);程序小可以考慮不計(jì),因?yàn)楝F(xiàn)在的硬盤實(shí)在太大了;完全免費(fèi)就不得不考慮了,即使網(wǎng)絡(luò)上有很多所謂的免費(fèi)軟件,但是,這些軟件的廣告卻不是我們喜歡的; wget雖然功能強(qiáng)大,但是使用起來還是比較簡(jiǎn)單的,基本的語法是:wget 參數(shù)列表 URL。下面就結(jié)合具體的例子來說明一下wget的用法。 注:wget url將會(huì)把文件下載到當(dāng)前目錄下面,如果將.wgetrc文件配置了proxy,則默認(rèn)情況下proxy是打開的。 1、下載整個(gè)http或者ftp站點(diǎn)。 wget http:/place.your.url/here 這個(gè)命令可以將http:/place.your.url/here 首頁(yè)下載下來。使用-x會(huì)強(qiáng)制建立服務(wù)器上一模一樣的目錄,如果使用-nd參數(shù),那么服務(wù)器上下載的所有內(nèi)容都會(huì)加到本地當(dāng)前目錄。 wget -r http:/place.your.url/here 這個(gè)命令會(huì)按照遞歸的方法,下載服務(wù)器上所有的目錄和文件,實(shí)質(zhì)就是下載整個(gè)網(wǎng)站。這個(gè)命令一定要小心使用,因?yàn)樵谙螺d的時(shí)候,被下載網(wǎng)站指向的所有地址同樣會(huì)被下載,因此,如果這個(gè)網(wǎng)站引用了其他網(wǎng)站,那么被引用的網(wǎng)站也會(huì)被下載下來!基于這個(gè)原因,這個(gè)參數(shù)不常用。 可以用-l number參數(shù)來指定下載的層次。例如只下載兩層,那么使用-l 2。 要是您想制作鏡像站點(diǎn),那么可以使用m參數(shù),例如:wget -m http:/place.your.url/here 這時(shí)wget會(huì)自動(dòng)判斷合適的參數(shù)來制作鏡像站點(diǎn)。此時(shí),wget會(huì)登錄到服務(wù)器上,讀入robots.txt并按robots.txt的規(guī)定來執(zhí)行。 2、斷點(diǎn)續(xù)傳。 當(dāng)文件特別大或者網(wǎng)絡(luò)特別慢的時(shí)候,往往一個(gè)文件還沒有下載完,連接就已經(jīng)被切斷,此時(shí)就需要斷點(diǎn)續(xù)傳。wget的斷點(diǎn)續(xù)傳是自動(dòng)的,只需要使用-c參數(shù),例如: wget -c http:/the.url.of/incomplete/file 使用斷點(diǎn)續(xù)傳要求服務(wù)器支持?jǐn)帱c(diǎn)續(xù)傳。-t參數(shù)表示重試次數(shù),例如需要重試100次,那么就寫-t 100,如果設(shè)成-t 0,那么表示無窮次重試,直到連接成功。-T參數(shù)表示超時(shí)等待時(shí)間,例如-T 120,表示等待120秒連接不上就算超時(shí)。 3、批量下載。 如果有多個(gè)文件需要下載,那么可以生成一個(gè)文件,把每個(gè)文件的URL寫一行,例如生成文件download.txt,然后用命令:wget -i download.txt 這樣就會(huì)把download.txt里面列出的每個(gè)URL都下載下來。(如果列的是文件就下載文件,如果列的是網(wǎng)站,那么下載首頁(yè)) 4、選擇性的下載。 可以指定讓wget只下載一類文件,或者不下載什么文件。例如: wget -m -reject=gif http:/target.web.site/subdirectory 表示下載http:/target.web.site/subdirectory,但是忽略gif文件。-accept=LIST 可以接受的文件類型,-reject=LIST拒絕接受的文件類型。 5、密碼和認(rèn)證。 wget只能處理利用用戶名/密碼方式限制訪問的網(wǎng)站,可以利用兩個(gè)參數(shù): -http-user=USER設(shè)置HTTP用戶 -http-passwd=PASS設(shè)置HTTP密碼 對(duì)于需要證書做認(rèn)證的網(wǎng)站,就只能利用其他下載工具了,例如curl。 6、利用代理服務(wù)器進(jìn)行下載。 如果用戶的網(wǎng)絡(luò)需要經(jīng)過代理服務(wù)器,那么可以讓wget通過代理服務(wù)器進(jìn)行文件的下載。此時(shí)需要在當(dāng)前用戶的目錄下創(chuàng)建一個(gè).wgetrc文件。文件中可以設(shè)置代理服務(wù)器: http-proxy = 11:8080 ftp-proxy = 11:8080 分別表示http的代理服務(wù)器和ftp的代理服務(wù)器。如果代理服務(wù)器需要密碼則使用: -proxy-user=USER設(shè)置代理用戶 -proxy-passwd=PASS設(shè)置代理密碼 這兩個(gè)參數(shù)。 使用參數(shù)-proxy=on/off 使用或者關(guān)閉代理。 wget還有很多有用的功能,需要用戶去挖掘。 附錄: 命令格式: wget 參數(shù)列表 網(wǎng)址 -V,-version 顯示軟件版本號(hào)然后退出; -h,-help顯示軟件幫助信息; -e,-execute=COMMAND 執(zhí)行一個(gè) “.wgetrc”命令 -o,-output-file=FILE 將軟件輸出信息保存到文件; -a,-append-output=FILE將軟件輸出信息追加到文件; -d,-debug顯示輸出信息; -q,-quiet 不顯示輸出信息; -i,-input-file=FILE 從文件中取得URL; -t,-tries=NUMBER 是否下載次數(shù)(0表示無窮次) -O -output-document=FILE下載文件保存為別的文件名 -nc, -no-clobber 不要覆蓋已經(jīng)存在的文件 -N,-timestamping只下載比本地新的文件 -T,-timeout=SECONDS 設(shè)置超時(shí)時(shí)間 -Y,-proxy=on/off 關(guān)閉代理 -nd,-no-directories 不建立目錄 -x,-force-directories 強(qiáng)制建立目錄 -http-user=USER設(shè)置HTTP用戶 -http-passwd=PASS設(shè)置HTTP密碼 -proxy-user=USER設(shè)置代理用戶 -proxy-passwd=PASS設(shè)置代理密碼 -r,-recursive 下載整個(gè)網(wǎng)站、目錄(小心使用) -l,-level=NUMBER 下載層次 -A,-accept=LIST 可以接受的文件類型 -R,-reject=LIST拒絕接受的文件類型 -D,-domains=LIST可以接受的域名 -exclude-domains=LIST拒絕的域名 -L,-relative 下載關(guān)聯(lián)鏈接 -follow-ftp 只下載FTP鏈接 -H,-span-hosts 可以下載外面的主機(jī) -I,-include-directories=LIST允許的目錄 -X,-exclude-directories=LIST 拒絕的目錄 中文文檔名在平常的情況下會(huì)被編碼, 但是在 -cut-dirs 時(shí)又是正常的, wget -r -np -nH -cut-dirs=3 ftp:/host/test/ 測(cè)試.txt wget -r -np -nH -nd ftp:/host/test/ %B4%FA%B8%D5.txt wget ftp:/host/test/* %B4%FA%B8%D5.txt 由於不知名的原因,可能是為了避開特殊檔名, wget 會(huì)自動(dòng)將抓取檔名的部分用 encode_string 處理過, 所以該 patch 就把被 encode_string 處理成 %3A 這種東西, 用 decode_string 還原成 :,并套用在目錄與檔案名稱的部分,decode_string 是 wget 內(nèi)建的函式。D: wget -helpSYSTEM_WGETRC = c:/progra1/wget/etc/wgetrcsyswgetrc = D:Program FilesGnuWin32/etc/wgetrcGNU Wget 1.11.4,非交互式的網(wǎng)絡(luò)文件下載工具。用法: wget 選項(xiàng). URL.Mandatory arguments to long options are mandatory for short options too.Startup: -V, -version display the version of Wget and exit. -h, -help print this help. -b, -background go to background after startup. -e, -execute=COMMAND execute a .wgetrc-style command.Logging and input file: -o, -output-file=FILE log messages to FILE. -a, -append-output=FILE append messages to FILE. -d, -debug print lots of debugging information. -q, -quiet quiet (no output). -v, -verbose be verbose (this is the default). -nv, -no-verbose turn off verboseness, without being quiet. -i, -input-file=FILE download URLs found in FILE. -F, -force-html treat input file as HTML. -B, -base=URL prepends URL to relative links in -F -i file.Download: -t, -tries=NUMBER set number of retries to NUMBER (0 unlimits). -retry-connrefused retry even if connection is refused. -O, -output-document=FILE write documents to FILE. -nc, -no-clobber skip downloads that would download to existing files. -c, -continue resume getting a partially-downloaded file. -progress=TYPE select progress gauge type. -N, -timestamping dont re-retrieve files unless newer than local. -S, -server-response print server response. -spider dont download anything. -T, -timeout=SECONDS set all timeout values to SECONDS. -dns-timeout=SECS set the DNS lookup timeout to SECS. -connect-timeout=SECS set the connect timeout to SECS. -read-timeout=SECS set the read timeout to SECS. -w, -wait=SECONDS wait SECONDS between retrievals. -waitretry=SECONDS wait 1.SECONDS between retries of a retrieval -random-wait wait from 0.2*WAIT secs between retrievals. -no-proxy explicitly turn off proxy. -Q, -quota=NUMBER set retrieval quota to NUMBER. -bind-address=ADDRESS bind to ADDRESS (hostname or IP) on local host -limit-rate=RATE limit download rate to RATE. -no-dns-cache disable caching DNS lookups. -restrict-file-names=OS restrict chars in file names to ones OS allows -ignore-case ignore case when matching files/directories. -4, -inet4-only connect only to IPv4 addresses. -6, -inet6-only connect only to IPv6 addresses. -prefer-family=FAMILY connect first to addresses of specified family one of IPv6, IPv4, or none. -user=USER set both ftp and http user to USER. -password=PASS set both ftp and http password to PASS.Directories: -nd, -no-directories dont create directories. -x, -force-directories force creation of directories. -nH, -no-host-directories dont create host directories. -protocol-directories use protocol name in directories. -P, -directory-prefix=PREFIX save files to PREFIX/. -cut-dirs=NUMBER ignore NUMBER remote directory components.HTTP options: -http-user=USER set http user to USER. -http-password=PASS set http password to PASS. -no-cache disallow server-cached data. -E, -html-extension save HTML documents with .html extension. -ignore-length ignore Content-Length header field. -header=STRING insert STRING among the headers. -max-redirect maximum redirections allowed per page. -proxy-user=USER set USER as proxy username. -proxy-password=PASS set PASS as proxy password. -referer=URL include Referer: URL header in HTTP request. -save-headers save the HTTP headers to file. -U, -user-agent=AGENT identify as AGENT instead of Wget/VERSION. -no-http-keep-alive disable HTTP keep-alive (persistent connections) -no-cookies dont use cookies. -load-cookies=FILE load cookies from FILE before session. -save-cookies=FILE save cookies to FILE after session. -keep-session-cookies load and save session (non-permanent) cookies. -post-data=STRING use the POST method; send STRING as the data. -post-file=FILE use the POST method; send contents of FILE. -content-disposition honor the Content-Disposition header when choosing local file names (EXPERIMENTAL). -auth-no-challenge Send Basic HTTP authentication information without first waiting for the servers challenge.HTTPS (SSL/TLS) options: -secure-protocol=PR choose secure protocol, one of auto, SSLv2, SSLv3, and TLSv1. -no-check-certificate dont validate the servers certificate. -certificate=FILE client certificate file. -certificate-type=TYPE client certificate type, PEM or DER. -private-key=FILE private key file. -private-key-type=TYPE private key type, PEM or DER. -ca-certificate=FILE file with the bundle of CAs. -ca-directory=DIR directory where hash list of CAs is stored. -random-file=FILE file with random data for seeding the SSL PRNG. -egd-file=FILE file naming the EGD socket with random data.FTP options: -ftp-user=USER set ftp user to USER. -ftp-password=PASS set ftp password to PASS. -no-remove-listing dont remove .listing files. -no-glob turn off FTP file name globbing. -no-passive-ftp disable the passive transfer mode. -retr-symlinks when recursing, get linked-to files (not dir). -preserve-permissions preserve remote file permissions.Recursive download: -r, -recursive specify recursive download. -l, -level=NUMBER maximum recursion depth (inf or 0 for infinite). -delete-after delete files locally after downloading them. -k, -convert-links make links in downloaded HTML point to local files. -K, -backup-converted before converting file X, back up as X.orig. -m, -mirror shortcut for -N -r -l inf -no-remove-listing. -p, -page-requisites get all images, etc. needed to display HTML page. -strict-comments turn on strict (SGML) handling of HTML comments.Recursive accept/reject: -A, -accept=LIST comma-separated list of accepted extensions. -R, -reject=LIST comma-separated list of rejected extensions. -D, -domains=LIST comma-separated list of accepted domains. -exclude-domains=LIST comma-separated list of rejected domains. -follow-ftp follow FTP links from HTML documents. -follow-tags=LIST comma-separated list of followed HTML tags. -ignore-tags=LIST comma-separated list of ignored HTML tags. -H, -span-hosts go to foreign hosts when recursive. -L, -relative follow relative links only. -I, -include-directories=LIST list of allowed directories. -X, -exclude-directories=LIST list of excluded directories. -np, -no-parent dont ascend to the parent directory.請(qǐng)將錯(cuò)誤報(bào)告或建議寄給 。88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888D: wget -helpSYSTEM_WGETRC = c:/progra1/wget/etc/wgetrcsyswgetrc = D:Program FilesGnuWin32/etc/wgetrcGNU Wget 1.11.4,非交互式的網(wǎng)絡(luò)文件下載工具。用法: wget 選項(xiàng). URL.Mandatory arguments to long options are mandatory for short options too.Startup: -V, -version display the version of Wget and exit. -h, -help print this help. -b, -background go to background after startup. -e, -execute=COMMAND execute a .wgetrc-style command.Logging and input file: -o, -output-file=FILE log messages to FILE. -a, -append-output=FILE append messages to FILE. -d, -debug print lots of debugging information. -q, -quiet quiet (no output). -v, -verbose be verbose (this is the default). -nv, -no-verbose turn off verboseness, without being quiet. -i, -input-file=FILE download URLs found in FILE. -F, -force-html treat input file as HTML. -B, -base=URL prepends URL to relative links in -F -i file.Download: -t, -tries=NUMBER set number of retries to NUMBER (0 unlimits). -retry-connrefused retry even if connection is refused. -O, -output-document=FILE write documents to FILE. -nc, -no-clobber skip downloads that would download to existing files. -c, -continue resume getting a partially-downloaded file. -progress=TYPE select progress gauge type. -N, -timestamping dont re-retrieve files unless newer than local. -S, -server-response print server response. -spider dont download anything. -T, -timeout=SECONDS set all timeout values to SECONDS. -dns-timeout=SECS set the DNS lookup timeout to SECS. -connect-timeout=SECS set the connect timeout to SECS. -read-timeout=SECS set the read timeout to SECS. -w, -wait=SECONDS wait SECONDS between retrievals. -waitretry=SECONDS wait 1.SECONDS between retries of a retrieval. -random-wait wait from 0.2*WAIT secs between retrievals. -no-proxy explicitly turn off proxy. -Q, -quota=NUMBER set retrieval quota to NUMBER. -bind-address=ADDRESS bind to ADDRESS (hostname or IP) on local host. -limit-rate=RATE limit download rate to RATE. -no-dns-cache disable caching DNS lookups. -restrict-file-names=OS restrict chars in file names to ones OS allows. -ignore-case ignore case when matching files/directories. -4, -inet4-only connect only to IPv4 addresses. -6, -inet6-only connect only to IPv6 addresses. -prefer-family=FAMILY connect first to addresses of specified family, one of IPv6, IPv4, or none. -user=USER set both ftp and http user to USER. -password=PASS set both ftp and http password to PASS.Directories: -nd, -no-directories dont create directories. -x, -force-directories force creation of directories. -nH, -no-host-directories dont create host directories. -protocol-directories use protocol name in directories. -P, -directory-prefix=PREFIX save files to PREFIX/. -cut-dirs=NUMBER ignore NUMBER remote directory components.HTTP options: -http-user=USER set http user to USER. -http-password=PASS set http password to PASS. -no-cache disallow server-cached data. -E, -html-extension save HTML documents with .html extension. -ignore-length ignore Content-Length header field. -header=STRING insert STRING among the headers. -max-redirect maximum redirections allowed per page. -proxy-user=USER set USER as proxy username. -proxy-password=PASS set PASS as proxy password. -referer=URL include Referer: URL header in HTTP request. -save-headers save the HTTP headers to file. -U, -user-agent=AGENT identify as AGENT instead of Wget/VERSION. -no-http-keep-alive disable HTTP keep-alive (persistent connections). -no-cookies dont use cookies. -load-cookies=FILE load cookies from FILE before session. -save-cookies=FILE save cookies to FILE after session. -keep-session-cookies load and save session (non-permanent) cookies. -post-data=STRING use the POST method; send STRING as the data. -post-file=FILE use the POST method; send contents of FILE. -content-disposition honor the Content-Disposition header when choosing local file names (EXPERIMENTAL). -auth-no-challenge Send Basic HTTP authentication information without first waiting for the servers challenge.HTTPS (SSL/TLS) options: -secure-protocol=PR choose secure protocol, one of auto, SSLv2, SSLv3, and TLSv1. -no-check-certificate dont validate the servers certificate. -certificate=FILE client certificate file. -certificate-type=TYPE client certificate type, PEM or DER. -private-key=FILE private key file. -private-key-type=TYPE private key type, PEM or DER. -ca-certificate=FILE file with the bundle of CAs. -ca-directory=DIR directory where hash list of CAs is stored. -random-file=FILE file with random data for seeding the SSL PRNG. -egd-file=FILE file naming the EGD socket with random data.FTP options: -ftp-

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論