Linuxwget command details

Source: Internet
Author: User
Tags ftp site
Wget is an open-source software developed in Linux, written by HrvojeNiksic, and then transplanted to various platforms including Windows. It has the following features and features: (1) support for resumable download; this is also the case when network Ant Financial and FlashGet...
Linux wget command details wget is an open-source software developed in Linux, written by Hrvoje Niksic, and subsequently transplanted to various platforms including Windows. It has the following features and features: (1) it supports the resumable download function. this is also the biggest selling point of network Ant Financial and FlashGet in the past. Currently, Wget can also use this function, users with poor networks can rest assured. (2) FTP and HTTP download methods are supported at the same time. although most software can be downloaded through HTTP, sometimes, you still need to download the software using FTP; www.2cto.com
(3) support for proxy servers. for systems with high security, generally, their systems are not directly exposed on the internet. therefore, support for proxy is a required function for downloading software; (4) easy to set; maybe, users who are used to the graphic interface are not too familiar with command line. However, the command line has more advantages in setting, at least, the mouse can be clicked many times, and do not worry about making a wrong mouse; (5) the program is small and completely free; the program is small and negligible, because the hard disk is too big now; even if there are many so-called free software on the Internet, the advertisement of these software is not what we like; although wget is powerful, however, it is relatively simple to use. the basic syntax is: wget [parameter list] URL. The following uses a specific example to describe how to use wget. 1. download the entire http or ftp site. Wget http://place.your.url/here This command can http://place.your.url/here Download the homepage. Using-x will force the creation of identical directories on the server. if The-nd parameter is used, all downloaded content on the server will be added to the local directory. Www.2cto.com wget-r http://place.your.url/here This command downloads all directories and files on the server in a recursive way. The essence is to download the entire website. This command must be used with caution, because during the download, all the addresses pointed to by the downloaded website will be downloaded in the same way. Therefore, if this website references other websites, the referenced website will also be downloaded! For this reason, this parameter is not commonly used. You can use the-l number parameter to specify the download level. For example, to download only two layers, use-l 2. If you want to create an image site, you can use the-m parameter, for example, wget-m. http://place.your.url/here At this time, wget will automatically determine the appropriate parameters to create an image site. Then, wgetwill be uploaded to the server and read to robots.txtand executed according to robots.txt. 2. resumable Upload. When the file size is very large or the network speed is very slow, the connection is often cut off before the file is downloaded. in this case, resumable data transfer is required. The resumable Upload of wget is automatic. you only need to use the-c parameter, for example, wget-c. http://the.url.of/incomplete/file Resumable data transfer requires the server to support resumable data transfer. The-t parameter indicates the number of retries. for example, if you need to retry 100 times, write-t 100. if it is set to-t 0, it indicates an infinite number of retries until the connection is successful. The-T parameter indicates the timeout wait time, for example,-T 120, indicating that a timeout occurs even if the connection fails for 120 seconds. Www.2cto.com 3. batch download. If multiple files are downloaded, you can generate a file, write the URL of each file in a line, for example, the generated file download.txt, and then run the command: wget-I download.txtto download each URL listed in download.txt. (If the column is a file, download the file, if the column is a website, then download the home page) 4. selective download. You can specify that wget only downloads one type of files, or does not download any files. Example: wget-m-reject = gif http://target.web.site/subdirectory Indicates download http://target.web.site/subdirectory But ignore the gif file. -Accept = LIST acceptable file types,-reject = LIST reject accepted file types. Www.2cto.com 5, password and authentication. Wget can only process websites restricted by user name/Password. Two parameters can be used: -http-user = USER: set HTTP user-http-passwd = PASS to set an HTTP password. for websites that require certificate authentication, you can only use other download tools, such as curl. 6. use the proxy server for download. If your network needs to go through the proxy server, you can have wget download files through the proxy server. Create a. wgetrc file in the current user directory. You can set the proxy server in the file: http-proxy = 111.111.111.111: 8080ftp-proxy = 111.111.111.111: 8080 to indicate the http proxy server and the ftp proxy server respectively. If the proxy server requires a password, use-proxy-user = USER to set the proxy user-proxy-passwd = PASS to set the proxy password. Use the-proxy = on/off parameter to use or disable the proxy. Wget also has many useful functions that need to be mined by users. Appendix: command format: wget [parameter list] [target software, web site] www.2cto.com-V,-version displays the software version number and then exits;-h,-help displays the software help information; -e,-execute = COMMAND to execute a ". wgetrc "command-o,-output-file = FILE to save the software output information to the FILE;-a,-append-output = file to append the software output information to the FILE;-d, -debug displays the output information.-q,-quiet does not display the output information.-I,-input-file = FILE retrieves the URL from the file.-t, -tries = NUMBER indicates the NUMBER of downloads (0 indicates infinite times)-O-output-document = FILE: save the downloaded FILE as another FILE name-nc, -no-clobber: do not overwrite the existing file-N.-timestamping only downloads new files-T,-timeout = SECONDS sets the timeout time-Y, -proxy = on/off disable proxy-nd,-no-directories do not create Directory-x, -force-directories: forcibly create the directory www.2cto.com-http-user = USER set HTTP user-http-passwd = PASS set HTTP password-proxy-USER = user set proxy USER-proxy-passwd = PASS sets the proxy password-r, -recursive: download the entire website and directory (used with caution)-l,-level = NUMBER download level-A,-accept = LIST acceptable file types-R, -reject = type of the file to be rejected by LIST-D,-domains = LIST acceptable domain name-exclude-domains = LIST rejected domain name-L, -relative download link-follow-ftp only download FTP Link-H,-span-hosts can download external host-I,-include-directories = LIST Directory-X, -exclude-directories = the Chinese document name of the directory rejected by LIST will be encoded normally, but it is normal in-cut-dirs, wget-r-np-nH-cut-dirs = 3 ftp://host/test/ Test .txt wget-r-np-nH-nd ftp://host/test/ When b4%fa1_b81_d5.txt wget" ftp://host/test/ * Unknown reasons for missing b4w.faw.b8w.d5.txt www.2cto.com may be due to the fact that wget automatically uses encode_string to process the part of the captured file name, therefore, this patch processes the content "% 3A" by encode_string, restores it to ":" Using decode_string, and applies it to the directory and file name, decode_string is the built-in function of wget. Wget-t0-c-nH-x-np-B-m-P/home/sunny/NOD32view/ http://downloads1.kaspersky-labs.com/bases/ -O wget. log
 
Related Article

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.