Easy-to-use wget command to add environment variables from the download to the detailed parameters

Source: Internet
Author: User
Tags ftp protocol

This article is because (I use the Windows system) after several wget, there are always a variety of details problems, so decided to study carefully, and record the details of it.

Download and install

The first step: Download wget, network address: Http://downloads.sourceforge.net/gnuwin32/wget-1.11.4-1-setup.exe (this address spread more widely, can search by itself)

The second step: Execute Wget.exe installation files, TIPS: Network said can not be installed in the C-Disk programes Files folder, after the author test is not affected, so you can choose the installation location.

The third step: Find the Post-installation Wget.exe file location, the author in: C:\Program files\gnuwin32\bin, will gnu_home = C:\Program Files\gnuwin32\bin added to the system environment variables, and add in the system variables;%gnu_home%\bin (the front semicolon is to isolate the previously added variable ), not the user environment variable , as shown in the red box:

Command details and test

We start with a little bit of learning from the basics.

1.-v,--version Displays the software revision number, or you can use the long parameter--version, with the following results:

2.-H,--HELP Display software help information to view all commands and usage profiles, results

3.-E,--Execute=command executes a ". Wgetrc" command, the. WGETRC command is actually a parameter list, WGETRC format see/ETC/WGETRC or ~/.WGETRC, directly write the required parameters of the software together, this list in C : \program Files\gnuwin32\etc, this is the author's local path, the wgetrc file command is a comment state, if you want to use the need to uncomment first. For example, the WGET-E robots=off URL is equivalent to the wget--execute=robots=off URL. Reference: Http://www.cnblogs.com/HappyThree/archive/2013/02/04/2892413.html. Wget By default will be based on the site's robots.txt, using the-e Robots=off parameter to bypass the limit;

4.-o,--output-file=file Save the software output information to a file, you do not want the download information to be displayed directly in the terminal but in a log file that can be used by the command:
Wget-o download.log URL, equivalent to wget--output-file=download.log URL

5.-a,--append-output=file Append the software output information to the file, the result is as follows:

6.-d,--debug Display output information;

7.-q,--quiet does not display output information;

8.-i,--input-file=file get the URL from the file, download all the files that are included in the Filelist.txt, wget-i Filelist.txt, a local must have a list of links, such as Http,http is a protocol header, otherwise not recognized, the final execution results are as follows, will read the file line by row:

9.-NP,--no-parent, does not go back to the parent directory.

10.-t,--tries=number Whether to download the number of times (0 means infinite);

11.-o--output-document=file Specify the download directory and file name;

12.-NC,--no-clobber do not overwrite files that already exist, and when they exist, they are prompted: file ' index.html ' already there;not retrieving.

13.-n,--timestamping only download newer files than the local;

14.-t,--Timeout=seconds To set the time-out period;

15.-y,--Proxy=on/off close agent;

16.-nd--no-directories does not establish a directory, if the download of the entire station, the value is not set by default, the name of the directory is established, the specified directory is not established, using-X will force the establishment of the same directory on the server, if you use the-nd parameter, All content downloaded by the server will be added to the local current directory.

17.-x,--force-directories forces a directory to be created, even if a file is forced to create a directory;

The 18.HTTP parameter sets some properties related to HTTP downloads.

--http-user=user Set HTTP User--http-passwd=pass set HTTP password--proxy-user=user set proxy user--proxy-passwd=pass set proxy password

19.-r,--recursive to download the entire Web site, directory (carefully used), to prevent the death of the loop, that is, tracking links to external websites.

20.-l,--level=number Download hierarchy, prevent infinite loops, you may miss the file if you know the level of the situation:

21.-a,--accept=list Acceptable file type, can accept commas;

22.-r,--Reject=list refused to accept the file type, with the opposite, can accept the comma;

23.-d,--domains=list can be accepted domain names, separated by commas;

24.--exclude-domains=list rejected domain names, separated by commas, with 23 opposite;

25.-l,--relative Download the associated link, specifying additional links to the association to prevent infinite recursion.

26.--follow-ftp only download FTP links, special needs;

27.-h,--span-hosts can download the outside host, specify whether the external host is downloaded.

28.-i,--include-directories=list allowed directories, which can be downloaded if the directory structure is known.

29.-x,--exclude-directories=list rejected directory, the directory structure must be known under the premise of the installation can not be downloaded. 30.wget can use the user settings file ". Wgetrc" to read a lot of settings, we here mainly use this file to be set proxy server. What user is logged in with, and what the ". Wgetrc" file under the home directory works. For example, if the "root" user wants to use ". Wgetrc" to set up a proxy server, "/ROOT/.WGETRC" will work, the following gives a ". wgetrc" file content, readers can refer to this example to write their own "WGETRC" File: Http-proxy = 111.111.111.111:8080 Ftp-proxy = 111.111.111.111:8080. The meaning of these two lines is that the proxy server IP address is: 111.111.111.111, the port number is: 8080. The first line specifies the proxy server used by the HTTP protocol, and the second line specifies the proxy server used by the FTP protocol. 31.-b,--background boot into the background execution, 32.-v,--verbose verbose mode (this is the default),-NV,--non-verbose turn off verbose mode, but not quiet mode; (the first is the verbose mode, which is the default The second is NV mode, which obviously shows much less information.)

33.-f,--force-html treats the input file as an HTML format file;

34.-b,--base=url the URL as the relative link prefix that appears in the file specified in the-f-i parameter, meaning the relative path file contained in the middle of the target file that needs to be downloaded.

35. The following three temporary records should not be used very often.

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

36.--bind-address=address specifies the local use address (host name or IP, used when there are multiple IPs or names locally), the local address can be viewed through the Ipconfig/all in the console:

37.-c,--continue then download the downloaded files, breakpoints continue to pass;

38.--progress=type set the process bar tag, select the form of the download progress bar, the legal TYPE has "dot" and "bar" (default) two;

39.-s,--server-response print server response;

Interrupt cmd is performing the task: Press CTRL + C, Exit Cmd:exit

40.--spider not to carry anything;

41.-w,--wait=seconds Two attempts intervals between SECONDS seconds;

42.--waitretry=seconds wait between Relink 1 ... seconds seconds;

43.--random-wait wait between downloads 0 ... 2*wait seconds;

44.-q,--quota=number set the download capacity limit;

45.--limit-rate=rate limit Download rate 46.-nh,--no-host-directories do not create host directory; The default host directory is created as follows: 47.-p,--directory-prefix=prefix Save file to Directory prefix/..., specify local save directory, 48.--cut-dirs=number ignore number layer remote directory, specify how many layers of remote directory are not downloaded; 49.-c,--cache=on/off allow/ Server-side data caching is not allowed (generally allowed); 50.-E,--html-extension saves all text/html documents with the. html extension and enforces the extension for the downloaded file, for example, remote is. htm, locally specified as. html; 51.--ignore-length ignores ' content-length ' header fields, Content-length: Used to describe the transmission length of an HTTP message entity; 52.--header=string inserts a string in headers 53.--referer=url include ' Referer:url ' header in HTTP request, 54.-s,--save-headers Save HTTP header to file;

55.-u,--user-agent=agent sets the proxy name as Agent instead of wget/version;

56.--no-http-keep-alive Close the HTTP activity link (forever link);

57.--cookies=off does not use Cookies;--load-cookies=file to load files from file before starting a session Cookie;--save-cookies=file save cookies After the end of the session File in

58.FTP options:

-NR,--dont-remove-listing do not remove the '. Listing ' file-G,--glob=on/off the globbing mechanism to turn file names on or off--PASSIVE-FTP use passive transfer mode (default).-- ACTIVE-FTP uses the active transfer mode--retr-symlinks when recursive, the link to the file (not the directory) 59.--delete-after after the completion of the local deletion of files; 60.-k,--convert-links Convert non-relative links to relative links; 61.-k,--backup-converted back to X.orig before converting file X;

62.-m,--mirror is equivalent to-r-n-l INF-NR;

63.-p,--page-requisites download all images showing HTML files;

Commands are many, 63, tested one after the other. Leave an impression, when used, with the use of the follow-up is good. Chinese Manual: Http://dwz.cn/4QH6aM

Easy-to-use wget command to add environment variables from the download to the detailed parameters

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.