"Linux Basics" wget command download

Source: Internet
Author: User
Tags mirror website save file

Original

1. Download a single file
wget  http://down.51cto.com/download.php?do=attachment&aid=1131994&k= 93d6cda54d8d1931041744ccb9fd54a7&t=1367300615&c=1
2. Download all files in a directory
wget  -r-np-nd  http://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/User_Guide/index.html

(-r recursive download;-NP does not go back to the parent directory;-nd does not create a directory)

3. Download the address in the file
Wget-i Flie_urls
4. Download files in the specified format
Wget-r-a.pdf http://bcmi.sjtu.edu.cn
5. Use wget--mirror Mirror website
wget--mirror-p--convert-links-p./local URL
Appendix: Command Parameters: Startup parameters:
    • -v,–version show wget version and exit
    • -H,–HELP Print Syntax Help
    • -b,–background Boot to background execution
    • -e,–execute=command execute '. Wgetrc ' Format command, WGETRC format see/ETC/WGETRC or ~/.WGETRC
Record and input file parameters
    • -o,–output-file=file Write 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 relative link prefix that appears in the file specified by the-f-i parameter

–sslcertfile=file Optional client certificate –sslcertkey=keyfile optional client certificate keyfile–egd-file=file Specifies the file name of the EGD socket

Download parameters
    • -bind-address=address specifies the local use address (host name or IP, used when there are multiple IPs or names locally)
    • -t,–tries=number sets the maximum number of attempts to link (0 means no limit).
    • -o–output-document=file writing documents to file files
    • -nc,–no-clobber do not overwrite existing files or use. #前缀
    • -c,–continue then download the files that are not downloaded
    • -progress=type Setting the Process bar flag
    • -n,–timestamping do not download files again unless newer than local files
    • -s,–server-response the print server response
    • -t,–timeout=seconds setting the number of seconds for response timeout
    • -w,–wait=seconds interval between two attempts SECONDS seconds
    • -waitretry=seconds wait between Relink 1 ... Seconds sec
    • -random-wait wait between downloads 0 ... 2*wait sec
    • -Y,-proxy=on/off turn agent on or off
    • -Q,-quota=number set the download capacity limit
    • -limit-rate=rate Limit Download Transmission rate
Catalog parameters
    • -nd–no-directories do not create a directory
    • -x,–force-directories forcing a directory to be created
    • -nh,–no-host-directories do not create a host directory
    • -p,–directory-prefix=prefix save file to directory prefix/...
    • -cut-dirs=number Ignore number layer remote directory
HTTP option Parameters
    • -http-user=user set the HTTP username to user.
    • -http-passwd=pass set HTTP password to PASS
    • -c,–cache=on/off Allow/Disallow server-side data caching (typically allowed)
    • -e,–html-extension Save all text/html documents with an. html extension
    • -ignore-length Ignore ' content-length ' header fields
    • -header=string inserting strings in headers string
    • -proxy-user=user set the user name of the agent
    • Proxy-passwd=pass set the password for the agent to PASS
    • Referer=url include ' Referer:url ' header in HTTP request
    • -s,–save-headers saving HTTP headers to a file
    • -u,–user-agent=agent set the agent name as agent instead of Wget/version
    • No-http-keep-alive Close HTTP Activity link (forever link)
    • Cookies=off Do not use cookies
    • Load-cookies=file loading a cookie from a file before starting a session
    • Save-cookies=file cookies are saved to the file after the session ends
FTP option Parameters
    • -nr,–dont-remove-listing do not remove '. Listing ' files
    • -g,–glob=on/off globbing mechanism for opening or closing filenames
    • The PASSIVE-FTP uses the passive transfer mode (the default value).
    • Active-ftp using active transfer mode
    • Retr-symlinks the link to the file (not the directory) at the time of recursion
Recursive download parameters
  • -r,–recursive recursive download--use with caution!

  • -l,–level=number maximum recursion depth (INF or 0 for Infinity)

  • -delete-after Delete files locally after it is finished

  • -k,–convert-links Convert non-relative links to relative links

  • -k,–backup-converted back to X.orig before converting file X

  • -m,–mirror equivalent to-r-n-l INF-NR

  • -p,–page-requisites Download all pictures showing HTML files

    Included and not included in the recursive Download (accept/reject):

  • -a,–accept=list a semicolon-delimited list of accepted extensions

  • -r,–reject=list semicolon-delimited list of non-accepted extensions

  • -d,–domains=list a semicolon-delimited list of accepted domains

  • -exclude-domains=list semicolon-delimited list of domains that are not accepted

  • -follow-ftp Tracking of FTP links in HTML documents

  • -follow-tags=list a semicolon-delimited list of tracked HTML tags

  • -g,–ignore-tags=list a 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 List of directories not included

  • -np,–no-parent don't go back to the parent directory

Wget-s–spider URL does not download only the display process

"Linux Basics" wget command download

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.