wget Command Detailed

Source: Internet
Author: User
Tags create directory html tags parent directory save file

Wget is a free tool for automatically downloading files from the network, which supports downloading via HTTP, HTTPS, FTP three most common TCP/IP protocols, and can use HTTP proxies. The origin of the wget name is the combination of "World Wide Web" and "get".

use format for wget

Usage:wget [OPTION] ... [URL] ... Use wget to do site mirroring:

Wget-r-p-np-k http://dsec.pku.edu.cn/~usr_name/

Or

Wget-m http://dsec.pku.edu.cn/~usr_name/downloads A partially downloaded file on an unstable network and downloads during idle hours

Wget-t 0-w 31-c http://dsec.pku.edu.cn/BBC.avi-o Down.log &

Or read the list of files to download from filelist

Wget-t 0-w 31-c-B ftp://dsec.pku.edu.cn/linuxsoft-i filelist.txt
-O Down.log &

The code above can also be used to download during periods when the network is more idle. My usage is to copy the URL link that was not conveniently downloaded in Mozilla to the memory and paste it into the file filelist.txt, and execute the second rule of the code before going out at night.
* Use the agent to download

Wget-y On-p-K https://sourceforge.net/projects/wvware/

Agents can be set in environment variables or WGETRC files
Setting up agents in environment variables

Export proxy=http://211.90.168.94:8080/

Setting up agents in ~/.WGETRC

Http_proxy = http://proxy.yoyodyne.com:18023/
ftp_proxy = http://proxy.yoyodyne.com:18023/

wget Various options Category List
* Start
-v,–version Displays the wget version and exits after
-H,–HELP Print Syntax Help
-b,–background to background execution after startup
-e,–execute=command executes the ' wgetrc ' Format command, WGETRC format see/ETC/WGETRC or ~/.WGETRC
* record and input files
-o,–output-file=file writes records to file
-a,–append-output=file Append records to File
-d,–debug Print Debug output
-q,–quiet Quiet mode (no output)
-v,–verbose Verbose mode (this is the default setting)
-nv,–non-verbose Turn off verbose mode, but not quiet mode
-i,–input-file=file download URLs that appear in file files
-f,–force-html treats the input file as an HTML format file
-b,–base=url the URL as the prefix of the relative link that appears in the file specified in the-f-i parameter
–sslcertfile=file Optional Client certificate
–sslcertkey=keyfile Optional Client certificate keyfile
–EGD-FILE=FILE Specifies the filename of the EGD socket
* Download
–bind-address=address specifies a local use address (hostname or IP, used when there are multiple IP or names locally)
-t,–tries=number sets the maximum number of attempts to link (0 indicates no limit).
-o–output-document=file writes documents to file
-nc,–no-clobber do not overwrite existing files or use. #前缀
-c,–continue then downloads the files that have not been downloaded.
–progress=type Set Process Bar tag
-n,–timestamping do not reload the file unless it is newer than the local file
-s,–server-response the print server response
–spider not to carry anything.
-t,–timeout=seconds the number of seconds to set the response timeout
-w,–wait=seconds interval SECONDS seconds between attempts two times
–waitretry=seconds wait 1 between relink ... Seconds seconds
–random-wait wait 0 between downloads ... 2*wait seconds
-y,–proxy=on/off turn on or off the agent
-q,–quota=number set capacity limits for downloads
–limit-rate=rate Limited Download rate
* Catalogue
-nd–no-directories does not create a directory
-x,–force-directories Force Create Directory
-nh,–no-host-directories does not create a host directory
-p,–directory-prefix=prefix save file to directory prefix/...
–cut-dirs=number Ignore number layer remote directory
* HTTP Options
–http-user=user sets the HTTP username to user.
–http-passwd=pass sets the HTTP password to pass.
-c,–cache=on/off allows/does not allow server-side data caching (generally allowed).
-e,–html-extension saves all text/html documents with an. html extension
–ignore-length Ignore ' content-length ' header field
–header=string inserts string strings in headers
–proxy-user=user Set Agent user name
–proxy-passwd=pass set the agent's password to pass
–referer=url contains ' referer:url ' headers in HTTP requests
-s,–save-headers Save HTTP headers to file
-u,–user-agent=agent the name of the agent is agent instead of wget/version.
–no-http-keep-alive closes the HTTP activity link (forever link).
–cookies=off do not use cookies.
–load-cookies=file load cookies from file files before the session starts
–save-cookies=file save cookies to file in the end of session
* FTP Options
-nr,–dont-remove-listing do not remove '. Listing ' files
-g,–glob=on/off globbing mechanism for opening or closing filenames
–PASSIVE-FTP uses the passive transfer mode (the default value).
–active-ftp Use active transfer mode
–retr-symlinks the link to a file (not a directory) when recursive
* Recursive Download
-r,–recursive recursive download--use with caution!
-l,–level=number maximum recursive depth (INF or 0 represents infinity).
–delete-after deletes the file locally after the current completion
-k,–convert-links Convert non-relative links to relative links
-k,–backup-converted to back up the file X before converting it to X.orig
-m,–mirror is equivalent to-r-n-l INF-NR.
-p,–page-requisites Download all pictures that display HTML files
* Included and not included in the recursive download (accept/reject)
-a,–accept=list semicolon-delimited list of accepted extension names
-r,–reject=list semicolon-delimited list of unacceptable extension names
-d,–domains=list semicolon-delimited list of accepted domains
–exclude-domains=list semicolon-delimited list of unacceptable domains
–FOLLOW-FTP tracking FTP links in HTML documents
–follow-tags=list semicolon-delimited list of tracked HTML tags
-g,–ignore-tags=list semicolon-delimited list of ignored HTML tags
-h,–span-hosts go to external host when recursion
-l,–relative only tracks relative links
-i,–include-directories=list List of allowed directories
-x,–exclude-directories=list is not included in the list of directories
-np,–no-parent do not trace back to the parent directory

Problem
The local directory name created by wget is processed with a URL encoding rule when a recursive download is encountered in Chinese in the directory. such as "Skynet Firewall" will be saved as "%CC%EC%CD%F8%B7%C0%BB%F0%C7%BD", which caused the inconvenience of reading.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.