What is wget in linux




















DNS lookups fail if not completed in the specified time. By default, there is no timeout on DNS lookups, other than that implemented by system libraries. Set the connect timeout to seconds seconds. TCP connections that take longer to establish are aborted. By default, there is no connect timeout, other than that implemented by system libraries. Set the read and write timeout to seconds seconds. Reads fail if they take longer. The default value for read timeout is seconds.

Limit the download speed to amount bytes per second. The amount may be expressed in bytes , kilobytes with the k suffix , or megabytes with the m suffix. This option is useful when, for whatever reason, you don't want wget to consume the entire available bandwidth. Note that wget implements the limiting by sleeping the appropriate amount of time after a network read that took less time than specified by the rate. Eventually this strategy causes the TCP transfer to slow down to approximately the specified rate.

However, it may take some time for this balance to be achieved, so don't be surprised if limiting the rate doesn't work well with very small files. Wait the specified number of seconds between the retrievals. Use of this option is recommended, as it lightens the server load by making the requests less frequent. Instead of in seconds, the time can be specified in minutes using the m suffix, in hours using h suffix, or in days using d suffix. Specifying a large value for this option is useful if the network or the destination host is down, so that wget can wait long enough to reasonably expect the network error to be fixed before the retry.

The waiting interval specified by this function is influenced by --random-wait see below. If you don't want wget to wait between every retrieval, but only between retries of failed downloads, you can use this option. By default, wget assumes a value of 10 seconds.

Some websites may perform log analysis to identify retrieval programs such as wget by looking for statistically significant similarities in the time between requests. Specify download quota for automatic retrievals. The value can be specified in bytes default , kilobytes with k suffix , or megabytes with m suffix. Note that quota never affects downloading a single file. The same goes even when several URLs are specified on the command-line.

However, quota is respected when retrieving either recursively , or from an input file. Thus you may safely type wget -Q2m -i sites ; download is aborted when the quota is exceeded. Setting quota to 0 or inf unlimits the download quota.

Turn off caching of DNS lookups. Normally, wget remembers the addresses it looked up from DNS so it doesn't have to repeatedly contact the DNS server for the same often small set of addresses it retrieves. This cache exists in memory only; a new wget run contacts DNS again. However, it was reported that in some situations it is not desirable to cache hostnames, even for the duration of a short-running application like wget.

With this option wget issues a new DNS lookup more precisely, a new call to " gethostbyname " or " getaddrinfo " each time it makes a new connection. Please note that this option does not affect caching that might be performed by the resolving library or by an external caching layer, such as NSCD. Characters that are restricted by this option are escaped , i.

By default, wget escapes the characters that are not valid as part of file names on your operating system, and control characters that are unprintable.

This option is useful for changing these defaults, either because you are downloading to a non-native partition, or because you want to disable escaping of the control characters. The modes are a comma-separated set of text values.

The acceptable values are unix , windows , nocontrol , ascii , lowercase , and uppercase. The values unix and windows are mutually exclusive one overrides the other , as are lowercase and uppercase. Those last are special cases, as they do not change the set of characters that would be escaped, but rather force local file paths to be converted either to lower or uppercase.

This option is the default on Unix-like OSes. Therefore, an URL that would be saved as www. This mode is the default on Windows. If you specify nocontrol , then the escaping of the control characters is also switched off.

This option may make sense when you are downloading URLs whose names contain UTF-8 characters , on a system that can save and display filen ames in UTF-8 some possible byte values used in UTF-8 byte sequences fall in the range of values designated by wget as "controls". The ascii mode is used to specify that any bytes whose values are outside the range of ASCII characters that is, greater than shall be escaped.

This mode can be useful when saving file names whose encoding does not match the one used locally. Force connecting to IPv4 or IPv6 addresses. Conversely, with --inet6-only or -6 , wget only connects to IPv6 hosts and ignore A records and IPv4 addresses. Neither options should be needed normally.

Also, see " --prefer-family " option described below. These options can deliberately force the use of IPv4 or IPv6 address families on dual family systems, usually to aid debugging or deal with broken network configuration. Only one of --inet6-only and --inet4-only may be specified at the same time. Neither option is available in wget compiled without IPv6 support. When given a choice of several addresses, connect to the addresses with specified address family first.

The address order returned by DNS is used without change by default. This avoids spurious errors and connect attempts when accessing hosts that resolve to both IPv6 and IPv4 addresses from IPv4 networks. For example, www. When the preferred family is " IPv4 ", the IPv4 address is used first; when the preferred family is " IPv6 ", the IPv6 address is used first; if the specified value is " none ", the address order returned by DNS is used without change. Unlike -4 and -6 , this option doesn't inhibit access to any address family, it only changes the order in which the addresses are accessed.

Also, note that the reordering performed by this option is stable; it doesn't affect order of addresses of the same family. That is, the relative order of all IPv4 addresses and of all IPv6 addresses remains intact in all cases. Consider "connection refused" a transient error and try again.

Normally, wget gives up on a URL when it cannot connect to the site because failure to connect is taken as a sign that the server is not running at all and that retries would not help. This option is for mirroring unreliable sites whose servers tend to disappear for short periods of time. These parameters can be overridden using the --ftp-user and --ftp-password options for FTP connections and the --http-user and --http-password options for HTTP connections.

Prompt for a password for each connection established. Cannot be specified when --password is used, because they are mutually exclusive. Use --iri to turn it on. IRI support is activated by default. You can set the default state of IRI support using the " iri " command in. Force wget to use encoding as the default system encoding. Force wget to use encoding as the default remote server encoding.

You can set the default encoding using the " remoteencoding " command in. Force wget to unlink file instead of clobbering existing file.

This option is useful for downloading to the directory with hardlinks. Do not create a hierarchy of directories when retrieving recursively. With this option turned on, all files get saved to the current directory , without clobbering if a name shows up more than once, the file names get extensions. The opposite of -nd ; create a hierarchy of directories, even if one would not be created otherwise.

Disable generation of host-prefixed directories. This option disables such behavior. Use the protocol name as a directory component of local file names. Ignore number directory components. This option is useful for getting a fine-grained control over the directory where recursive retrieval is saved. If you retrieve it with -r , it is saved locally under ftp. While the -nH option can remove the ftp. Here are several examples of how --cut-dirs option works: no options. Set directory prefix to prefix.

The directory prefix is the directory where all other files and subdirectories are saved to, i. The default is ".

This option is useful, for instance, when you're mirroring a remote site that uses. Another good use for this is when you're downloading CGI -generated materials. Note that file names changed in this way are re-downloaded every time you re-mirror a site, because wget can't tell that the local X.

As of version 1. By default, the wget command downloads a file in the directory that the user is currently in. To save the file in a different location, add the —P option:. Additionally, you can download multiple files concurrently using the -i option.

Then append the URLs of the packages you want to download in the editor each in its own line. Once done, save and exit the text editor. And finally r un the following command to download the multiple files in the nano file we just created:.

To download a file and save it under a specified name in your system, use the -o option in the syntax shown. For example to download tomcat and save it under tomcat.

In the following example, we are resuming the download of the Ubuntu ISO file after an interrupted connection:. Syntax : wget [option] [URL] Example : 1. To overwrite the log while of the wget command. If no log file has been specified then the output messages are redirected to the default log file i. If no output file is specified via the -o option, output is redirected to wget-log by default. If -i is specified as file, URLs are read from the standard input. If this function is used, no URLs need be present on the command line.

If there are URLs both on the command line and in an input file, those on the command lines will be the first ones to be retrieved. Specify 0 or inf for infinite retrying.

Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published. Save my name, email, and website in this browser for the next time I comment. Notify me of followup comments via e-mail. You can also subscribe without commenting. This site uses Akismet to reduce spam.



0コメント

  • 1000 / 1000