man-pages/man1/wget.1.html
2021-03-31 01:06:50 +01:00

3494 lines
113 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of WGET</TITLE>
</HEAD><BODY>
<H1>WGET</H1>
Section: GNU Wget (1)<BR>Updated: 2019-07-24<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
Wget - The non-interactive network downloader.
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
wget [<I>option</I>]... [<I></I><FONT SIZE="-1"><I>URL</I></FONT><I></I>]...
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<FONT SIZE="-1">GNU</FONT> Wget is a free utility for non-interactive download of files from
the Web. It supports <FONT SIZE="-1">HTTP, HTTPS,</FONT> and <FONT SIZE="-1">FTP</FONT> protocols, as
well as retrieval through <FONT SIZE="-1">HTTP</FONT> proxies.
<P>
Wget is non-interactive, meaning that it can work in the background,
while the user is not logged on. This allows you to start a retrieval
and disconnect from the system, letting Wget finish the work. By
contrast, most of the Web browsers require constant user's presence,
which can be a great hindrance when transferring a lot of data.
<P>
Wget can follow links in <FONT SIZE="-1">HTML, XHTML,</FONT> and <FONT SIZE="-1">CSS</FONT> pages, to
create local versions of remote web sites, fully recreating the
directory structure of the original site. This is sometimes referred to
as ``recursive downloading.'' While doing that, Wget respects the Robot
Exclusion Standard (<I>/robots.txt</I>). Wget can be instructed to
convert the links in downloaded files to point at the local files, for
offline viewing.
<P>
Wget has been designed for robustness over slow or unstable network
connections; if a download fails due to a network problem, it will
keep retrying until the whole file has been retrieved. If the server
supports regetting, it will instruct the server to continue the
download from where it left off.
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
<A NAME="lbAF">&nbsp;</A>
<H3>Option Syntax</H3>
Since Wget uses <FONT SIZE="-1">GNU</FONT> getopt to process command-line arguments, every
option has a long form along with the short one. Long options are
more convenient to remember, but take time to type. You may freely
mix different option styles, or specify options after the command-line
arguments. Thus you may write:
<P>
<PRE>
wget -r --tries=10 <A HREF="http://fly.srk.fer.hr/">http://fly.srk.fer.hr/</A> -o log
</PRE>
<P>
The space between the option accepting an argument and the argument may
be omitted. Instead of <B>-o log</B> you can write <B>-olog</B>.
<P>
You may put several options that do not require arguments together,
like:
<P>
<PRE>
wget -drc &lt;URL&gt;
</PRE>
<P>
This is completely equivalent to:
<P>
<PRE>
wget -d -r -c &lt;URL&gt;
</PRE>
<P>
Since the options can be specified after the arguments, you may
terminate them with <B>--</B>. So the following will try to download
<FONT SIZE="-1">URL</FONT> <B>-x</B>, reporting failure to <I>log</I>:
<P>
<PRE>
wget -o log -- -x
</PRE>
<P>
The options that accept comma-separated lists all respect the convention
that specifying an empty list clears its value. This can be useful to
clear the <I>.wgetrc</I> settings. For instance, if your <I>.wgetrc</I>
sets <TT>&quot;exclude_directories&quot;</TT> to <I>/cgi-bin</I>, the following
example will first reset it, and then set it to exclude <I>/~nobody</I>
and <I>/~somebody</I>. You can also clear the lists in <I>.wgetrc</I>.
<P>
<PRE>
wget -X &quot; -X /~nobody,/~somebody
</PRE>
<P>
Most options that do not accept arguments are <I>boolean</I> options,
so named because their state can be captured with a yes-or-no
(``boolean'') variable. For example, <B>--follow-ftp</B> tells Wget
to follow <FONT SIZE="-1">FTP</FONT> links from <FONT SIZE="-1">HTML</FONT> files and, on the other hand,
<B>--no-glob</B> tells it not to perform file globbing on <FONT SIZE="-1">FTP</FONT> URLs. A
boolean option is either <I>affirmative</I> or <I>negative</I>
(beginning with <B>--no</B>). All such options share several
properties.
<P>
Unless stated otherwise, it is assumed that the default behavior is
the opposite of what the option accomplishes. For example, the
documented existence of <B>--follow-ftp</B> assumes that the default
is to <I>not</I> follow <FONT SIZE="-1">FTP</FONT> links from <FONT SIZE="-1">HTML</FONT> pages.
<P>
Affirmative options can be negated by prepending the <B>--no-</B> to
the option name; negative options can be negated by omitting the
<B>--no-</B> prefix. This might seem superfluous---if the default for
an affirmative option is to not do something, then why provide a way
to explicitly turn it off? But the startup file may in fact change
the default. For instance, using <TT>&quot;follow_ftp = on&quot;</TT> in
<I>.wgetrc</I> makes Wget <I>follow</I> <FONT SIZE="-1">FTP</FONT> links by default, and
using <B>--no-follow-ftp</B> is the only way to restore the factory
default from the command line.
<A NAME="lbAG">&nbsp;</A>
<H3>Basic Startup Options</H3>
<DL COMPACT>
<DT id="1"><B>-V</B><DD>
<DT id="2"><B>--version</B><DD>
Display the version of Wget.
<DT id="3"><B>-h</B><DD>
<DT id="4"><B>--help</B><DD>
Print a help message describing all of Wget's command-line options.
<DT id="5"><B>-b</B><DD>
<DT id="6"><B>--background</B><DD>
Go to background immediately after startup. If no output file is
specified via the <B>-o</B>, output is redirected to <I>wget-log</I>.
<DT id="7"><B>-e</B> <I>command</I><DD>
<DT id="8"><B>--execute</B> <I>command</I><DD>
Execute <I>command</I> as if it were a part of <I>.wgetrc</I>. A command thus invoked will be executed
<I>after</I> the commands in <I>.wgetrc</I>, thus taking precedence over
them. If you need to specify more than one wgetrc command, use multiple
instances of <B>-e</B>.
</DL>
<A NAME="lbAH">&nbsp;</A>
<H3>Logging and Input File Options</H3>
<DL COMPACT>
<DT id="9"><B>-o</B> <I>logfile</I><DD>
<DT id="10"><B>--output-file=</B><I>logfile</I><DD>
Log all messages to <I>logfile</I>. The messages are normally reported
to standard error.
<DT id="11"><B>-a</B> <I>logfile</I><DD>
<DT id="12"><B>--append-output=</B><I>logfile</I><DD>
Append to <I>logfile</I>. This is the same as <B>-o</B>, only it appends
to <I>logfile</I> instead of overwriting the old log file. If
<I>logfile</I> does not exist, a new file is created.
<DT id="13"><B>-d</B><DD>
<DT id="14"><B>--debug</B><DD>
Turn on debug output, meaning various information important to the
developers of Wget if it does not work properly. Your system
administrator may have chosen to compile Wget without debug support, in
which case <B>-d</B> will not work. Please note that compiling with
debug support is always safe---Wget compiled with the debug support will
<I>not</I> print any debug info unless requested with <B>-d</B>.
<DT id="15"><B>-q</B><DD>
<DT id="16"><B>--quiet</B><DD>
Turn off Wget's output.
<DT id="17"><B>-v</B><DD>
<DT id="18"><B>--verbose</B><DD>
Turn on verbose output, with all the available data. The default output
is verbose.
<DT id="19"><B>-nv</B><DD>
<DT id="20"><B>--no-verbose</B><DD>
Turn off verbose without being completely quiet (use <B>-q</B> for
that), which means that error messages and basic information still get
printed.
<DT id="21"><B>--report-speed=</B><I>type</I><DD>
Output bandwidth as <I>type</I>. The only accepted value is <B>bits</B>.
<DT id="22"><B>-i</B> <I>file</I><DD>
<DT id="23"><B>--input-file=</B><I>file</I><DD>
Read URLs from a local or external <I>file</I>. If <B>-</B> is
specified as <I>file</I>, URLs are read from the standard input.
(Use <B>./-</B> to read from a file literally named <B>-</B>.)
<P>
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. If <B>--force-html</B> is not specified, then <I>file</I>
should consist of a series of URLs, one per line.
<P>
However, if you specify <B>--force-html</B>, the document will be
regarded as <B>html</B>. In that case you may have problems with
relative links, which you can solve either by adding <TT>&quot;&lt;base
href=&quot;</TT>url<TT>&quot;&gt;&quot;</TT> to the documents or by specifying
<B>--base=</B><I>url</I> on the command line.
<P>
If the <I>file</I> is an external one, the document will be automatically
treated as <B>html</B> if the Content-Type matches <B>text/html</B>.
Furthermore, the <I>file</I>'s location will be implicitly used as base
href if none was specified.
<DT id="24"><B>--input-metalink=</B><I>file</I><DD>
Downloads files covered in local Metalink <I>file</I>. Metalink version 3
and 4 are supported.
<DT id="25"><B>--keep-badhash</B><DD>
Keeps downloaded Metalink's files with a bad hash. It appends .badhash
to the name of Metalink's files which have a checksum mismatch, except
without overwriting existing files.
<DT id="26"><B>--metalink-over-http</B><DD>
Issues <FONT SIZE="-1">HTTP HEAD</FONT> request instead of <FONT SIZE="-1">GET</FONT> and extracts Metalink metadata
from response headers. Then it switches to Metalink download.
If no valid Metalink metadata is found, it falls back to ordinary <FONT SIZE="-1">HTTP</FONT> download.
Enables <B>Content-Type: application/metalink4+xml</B> files download/processing.
<DT id="27"><B>--metalink-index=</B><I>number</I><DD>
Set the Metalink <B>application/metalink4+xml</B> metaurl ordinal
<FONT SIZE="-1">NUMBER.</FONT> From 1 to the total number of ``application/metalink4+xml''
available. Specify 0 or <B>inf</B> to choose the first good one.
Metaurls, such as those from a <B>--metalink-over-http</B>, may have
been sorted by priority key's value; keep this in mind to choose the
right <FONT SIZE="-1">NUMBER.</FONT>
<DT id="28"><B>--preferred-location</B><DD>
Set preferred location for Metalink resources. This has effect if multiple
resources with same priority are available.
<DT id="29"><B>--xattr</B><DD>
Enable use of file system's extended attributes to save the
original <FONT SIZE="-1">URL</FONT> and the Referer <FONT SIZE="-1">HTTP</FONT> header value if used.
<P>
Be aware that the <FONT SIZE="-1">URL</FONT> might contain private information like
access tokens or credentials.
<DT id="30"><B>-F</B><DD>
<DT id="31"><B>--force-html</B><DD>
When input is read from a file, force it to be treated as an <FONT SIZE="-1">HTML</FONT>
file. This enables you to retrieve relative links from existing
<FONT SIZE="-1">HTML</FONT> files on your local disk, by adding <TT>&quot;&lt;base
href=&quot;</TT>url<TT>&quot;&gt;&quot;</TT> to <FONT SIZE="-1">HTML,</FONT> or using the <B>--base</B> command-line
option.
<DT id="32"><B>-B</B> <I></I><FONT SIZE="-1"><I>URL</I></FONT><I></I><DD>
<DT id="33"><B>--base=</B><I></I><FONT SIZE="-1"><I>URL</I></FONT><I></I><DD>
Resolves relative links using <I></I><FONT SIZE="-1"><I>URL</I></FONT><I></I> as the point of reference,
when reading links from an <FONT SIZE="-1">HTML</FONT> file specified via the
<B>-i</B>/<B>--input-file</B> option (together with
<B>--force-html</B>, or when the input file was fetched remotely from
a server describing it as <FONT SIZE="-1">HTML</FONT>). This is equivalent to the
presence of a <TT>&quot;BASE&quot;</TT> tag in the <FONT SIZE="-1">HTML</FONT> input file, with
<I></I><FONT SIZE="-1"><I>URL</I></FONT><I></I> as the value for the <TT>&quot;href&quot;</TT> attribute.
<P>
For instance, if you specify <B><A HREF="http://foo/bar/a.html">http://foo/bar/a.html</A></B> for
<I></I><FONT SIZE="-1"><I>URL</I></FONT><I></I>, and Wget reads <B>../baz/b.html</B> from the input file, it
would be resolved to <B><A HREF="http://foo/baz/b.html">http://foo/baz/b.html</A></B>.
<DT id="34"><B>--config=</B><I></I><FONT SIZE="-1"><I>FILE</I></FONT><I></I><DD>
Specify the location of a startup file you wish to use instead of the
default one(s). Use --no-config to disable reading of config files.
If both --config and --no-config are given, --no-config is ignored.
<DT id="35"><B>--rejected-log=</B><I>logfile</I><DD>
Logs all <FONT SIZE="-1">URL</FONT> rejections to <I>logfile</I> as comma separated values. The values
include the reason of rejection, the <FONT SIZE="-1">URL</FONT> and the parent <FONT SIZE="-1">URL</FONT> it was found in.
</DL>
<A NAME="lbAI">&nbsp;</A>
<H3>Download Options</H3>
<DL COMPACT>
<DT id="36"><B>--bind-address=</B><I></I><FONT SIZE="-1"><I>ADDRESS</I></FONT><I></I><DD>
When making client <FONT SIZE="-1">TCP/IP</FONT> connections, bind to <I></I><FONT SIZE="-1"><I>ADDRESS</I></FONT><I></I> on
the local machine. <I></I><FONT SIZE="-1"><I>ADDRESS</I></FONT><I></I> may be specified as a hostname or <FONT SIZE="-1">IP</FONT>
address. This option can be useful if your machine is bound to multiple
IPs.
<DT id="37"><B>--bind-dns-address=</B><I></I><FONT SIZE="-1"><I>ADDRESS</I></FONT><I></I><DD>
[libcares only]
This address overrides the route for <FONT SIZE="-1">DNS</FONT> requests. If you ever need to
circumvent the standard settings from /etc/resolv.conf, this option together
with <B>--dns-servers</B> is your friend.
<I></I><FONT SIZE="-1"><I>ADDRESS</I></FONT><I></I> must be specified either as IPv4 or IPv6 address.
Wget needs to be built with libcares for this option to be available.
<DT id="38"><B>--dns-servers=</B><I></I><FONT SIZE="-1"><I>ADDRESSES</I></FONT><I></I><DD>
[libcares only]
The given address(es) override the standard nameserver
addresses, e.g. as configured in /etc/resolv.conf.
<I></I><FONT SIZE="-1"><I>ADDRESSES</I></FONT><I></I> may be specified either as IPv4 or IPv6 addresses,
comma-separated.
Wget needs to be built with libcares for this option to be available.
<DT id="39"><B>-t</B> <I>number</I><DD>
<DT id="40"><B>--tries=</B><I>number</I><DD>
Set number of tries to <I>number</I>. Specify 0 or <B>inf</B> for
infinite retrying. The default is to retry 20 times, with the exception
of fatal errors like ``connection refused'' or ``not found'' (404),
which are not retried.
<DT id="41"><B>-O</B> <I>file</I><DD>
<DT id="42"><B>--output-document=</B><I>file</I><DD>
The documents will not be written to the appropriate files, but all
will be concatenated together and written to <I>file</I>. If <B>-</B>
is used as <I>file</I>, documents will be printed to standard output,
disabling link conversion. (Use <B>./-</B> to print to a file
literally named <B>-</B>.)
<P>
Use of <B>-O</B> is <I>not</I> intended to mean simply &quot;use the name
<I>file</I> instead of the one in the <FONT SIZE="-1">URL</FONT>;&quot; rather, it is
analogous to shell redirection:
<B>wget -O file <A HREF="http://foo">http://foo</A></B> is intended to work like
<B>wget -O - <A HREF="http://foo">http://foo</A> &gt; file</B>; <I>file</I> will be truncated
immediately, and <I>all</I> downloaded content will be written there.
<P>
For this reason, <B>-N</B> (for timestamp-checking) is not supported
in combination with <B>-O</B>: since <I>file</I> is always newly
created, it will always have a very new timestamp. A warning will be
issued if this combination is used.
<P>
Similarly, using <B>-r</B> or <B>-p</B> with <B>-O</B> may not work as
you expect: Wget won't just download the first file to <I>file</I> and
then download the rest to their normal names: <I>all</I> downloaded
content will be placed in <I>file</I>. This was disabled in version
1.11, but has been reinstated (with a warning) in 1.11.2, as there are
some cases where this behavior can actually have some use.
<P>
A combination with <B>-nc</B> is only accepted if the given output
file does not exist.
<P>
Note that a combination with <B>-k</B> is only permitted when
downloading a single document, as in that case it will just convert
all relative URIs to external ones; <B>-k</B> makes no sense for
multiple URIs when they're all being downloaded to a single file;
<B>-k</B> can be used only when the output is a regular file.
<DT id="43"><B>-nc</B><DD>
<DT id="44"><B>--no-clobber</B><DD>
If a file is downloaded more than once in the same directory, Wget's
behavior depends on a few options, including <B>-nc</B>. In certain
cases, the local file will be <I>clobbered</I>, or overwritten, upon
repeated download. In other cases it will be preserved.
<P>
When running Wget without <B>-N</B>, <B>-nc</B>, <B>-r</B>, or
<B>-p</B>, downloading the same file in the same directory will result
in the original copy of <I>file</I> being preserved and the second copy
being named <I>file</I><B>.1</B>. If that file is downloaded yet
again, the third copy will be named <I>file</I><B>.2</B>, and so on.
(This is also the behavior with <B>-nd</B>, even if <B>-r</B> or
<B>-p</B> are in effect.) When <B>-nc</B> is specified, this behavior
is suppressed, and Wget will refuse to download newer copies of
<I>file</I>. Therefore, &quot;<TT>&quot;no-clobber&quot;</TT>&quot; is actually a
misnomer in this mode---it's not clobbering that's prevented (as the
numeric suffixes were already preventing clobbering), but rather the
multiple version saving that's prevented.
<P>
When running Wget with <B>-r</B> or <B>-p</B>, but without <B>-N</B>,
<B>-nd</B>, or <B>-nc</B>, re-downloading a file will result in the
new copy simply overwriting the old. Adding <B>-nc</B> will prevent
this behavior, instead causing the original version to be preserved
and any newer copies on the server to be ignored.
<P>
When running Wget with <B>-N</B>, with or without <B>-r</B> or
<B>-p</B>, the decision as to whether or not to download a newer copy
of a file depends on the local and remote timestamp and size of the
file. <B>-nc</B> may not be specified at the
same time as <B>-N</B>.
<P>
A combination with <B>-O</B>/<B>--output-document</B> is only accepted
if the given output file does not exist.
<P>
Note that when <B>-nc</B> is specified, files with the suffixes
<B>.html</B> or <B>.htm</B> will be loaded from the local disk and
parsed as if they had been retrieved from the Web.
<DT id="45"><B>--backups=</B><I>backups</I><DD>
Before (over)writing a file, back up an existing file by adding a
<B>.1</B> suffix (<B>_1</B> on <FONT SIZE="-1">VMS</FONT>) to the file name. Such backup
files are rotated to <B>.2</B>, <B>.3</B>, and so on, up to
<I>backups</I> (and lost beyond that).
<DT id="46"><B>--no-netrc</B><DD>
Do not try to obtain credentials from <I>.netrc</I> file. By default
<I>.netrc</I> file is searched for credentials in case none have been
passed on command line and authentication is required.
<DT id="47"><B>-c</B><DD>
<DT id="48"><B>--continue</B><DD>
Continue getting a partially-downloaded file. This is useful when you
want to finish up a download started by a previous instance of Wget, or
by another program. For instance:
<P>
<PRE>
wget -c <A HREF="ftp://sunsite.doc.ic.ac.uk/ls-lR.Z">ftp://sunsite.doc.ic.ac.uk/ls-lR.Z</A>
</PRE>
<P>
If there is a file named <I>ls-lR.Z</I> in the current directory, Wget
will assume that it is the first portion of the remote file, and will
ask the server to continue the retrieval from an offset equal to the
length of the local file.
<P>
Note that you don't need to specify this option if you just want the
current invocation of Wget to retry downloading a file should the
connection be lost midway through. This is the default behavior.
<B>-c</B> only affects resumption of downloads started <I>prior</I> to
this invocation of Wget, and whose local files are still sitting around.
<P>
Without <B>-c</B>, the previous example would just download the remote
file to <I>ls-lR.Z.1</I>, leaving the truncated <I>ls-lR.Z</I> file
alone.
<P>
If you use <B>-c</B> on a non-empty file, and the server does not support
continued downloading, Wget will restart the download from scratch and overwrite
the existing file entirely.
<P>
Beginning with Wget 1.7, if you use <B>-c</B> on a file which is of
equal size as the one on the server, Wget will refuse to download the
file and print an explanatory message. The same happens when the file
is smaller on the server than locally (presumably because it was changed
on the server since your last download attempt)---because ``continuing''
is not meaningful, no download occurs.
<P>
On the other side of the coin, while using <B>-c</B>, any file that's
bigger on the server than locally will be considered an incomplete
download and only <TT>&quot;(length(remote) - length(local))&quot;</TT> bytes will be
downloaded and tacked onto the end of the local file. This behavior can
be desirable in certain cases---for instance, you can use <B>wget -c</B>
to download just the new portion that's been appended to a data
collection or log file.
<P>
However, if the file is bigger on the server because it's been
<I>changed</I>, as opposed to just <I>appended</I> to, you'll end up
with a garbled file. Wget has no way of verifying that the local file
is really a valid prefix of the remote file. You need to be especially
careful of this when using <B>-c</B> in conjunction with <B>-r</B>,
since every file will be considered as an ``incomplete download'' candidate.
<P>
Another instance where you'll get a garbled file if you try to use
<B>-c</B> is if you have a lame <FONT SIZE="-1">HTTP</FONT> proxy that inserts a
``transfer interrupted'' string into the local file. In the future a
``rollback'' option may be added to deal with this case.
<P>
Note that <B>-c</B> only works with <FONT SIZE="-1">FTP</FONT> servers and with <FONT SIZE="-1">HTTP</FONT>
servers that support the <TT>&quot;Range&quot;</TT> header.
<DT id="49"><B>--start-pos=</B><I></I><FONT SIZE="-1"><I>OFFSET</I></FONT><I></I><DD>
Start downloading at zero-based position <I></I><FONT SIZE="-1"><I>OFFSET</I></FONT><I></I>. Offset may be expressed
in bytes, kilobytes with the `k' suffix, or megabytes with the `m' suffix, etc.
<P>
<B>--start-pos</B> has higher precedence over <B>--continue</B>. When
<B>--start-pos</B> and <B>--continue</B> are both specified, wget will emit a
warning then proceed as if <B>--continue</B> was absent.
<P>
Server support for continued download is required, otherwise <B>--start-pos</B>
cannot help. See <B>-c</B> for details.
<DT id="50"><B>--progress=</B><I>type</I><DD>
Select the type of the progress indicator you wish to use. Legal
indicators are ``dot'' and ``bar''.
<P>
The ``bar'' indicator is used by default. It draws an <FONT SIZE="-1">ASCII</FONT> progress
bar graphics (a.k.a ``thermometer'' display) indicating the status of
retrieval. If the output is not a <FONT SIZE="-1">TTY,</FONT> the ``dot'' bar will be used by
default.
<P>
Use <B>--progress=dot</B> to switch to the ``dot'' display. It traces
the retrieval by printing dots on the screen, each dot representing a
fixed amount of downloaded data.
<P>
The progress <I>type</I> can also take one or more parameters. The parameters
vary based on the <I>type</I> selected. Parameters to <I>type</I> are passed by
appending them to the type sperated by a colon (:) like this:
<B>--progress=</B><I>type</I><B>:</B><I>parameter1</I><B>:</B><I>parameter2</I>.
<P>
When using the dotted retrieval, you may set the <I>style</I> by
specifying the type as <B>dot:</B><I>style</I>. Different styles assign
different meaning to one dot. With the <TT>&quot;default&quot;</TT> style each dot
represents 1K, there are ten dots in a cluster and 50 dots in a line.
The <TT>&quot;binary&quot;</TT> style has a more ``computer''-like orientation---8K
dots, 16-dots clusters and 48 dots per line (which makes for 384K
lines). The <TT>&quot;mega&quot;</TT> style is suitable for downloading large
files---each dot represents 64K retrieved, there are eight dots in a
cluster, and 48 dots on each line (so each line contains 3M).
If <TT>&quot;mega&quot;</TT> is not enough then you can use the <TT>&quot;giga&quot;</TT>
style---each dot represents 1M retrieved, there are eight dots in a
cluster, and 32 dots on each line (so each line contains 32M).
<P>
With <B>--progress=bar</B>, there are currently two possible parameters,
<I>force</I> and <I>noscroll</I>.
<P>
When the output is not a <FONT SIZE="-1">TTY,</FONT> the progress bar always falls back to ``dot'',
even if <B>--progress=bar</B> was passed to Wget during invocation. This
behaviour can be overridden and the ``bar'' output forced by using the ``force''
parameter as <B>--progress=bar:force</B>.
<P>
By default, the <B>bar</B> style progress bar scroll the name of the file from
left to right for the file being downloaded if the filename exceeds the maximum
length allotted for its display. In certain cases, such as with
<B>--progress=bar:force</B>, one may not want the scrolling filename in the
progress bar. By passing the ``noscroll'' parameter, Wget can be forced to
display as much of the filename as possible without scrolling through it.
<P>
Note that you can set the default style using the <TT>&quot;progress&quot;</TT>
command in <I>.wgetrc</I>. That setting may be overridden from the
command line. For example, to force the bar output without scrolling,
use <B>--progress=bar:force:noscroll</B>.
<DT id="51"><B>--show-progress</B><DD>
Force wget to display the progress bar in any verbosity.
<P>
By default, wget only displays the progress bar in verbose mode. One may
however, want wget to display the progress bar on screen in conjunction with
any other verbosity modes like <B>--no-verbose</B> or <B>--quiet</B>. This
is often a desired a property when invoking wget to download several small/large
files. In such a case, wget could simply be invoked with this parameter to get
a much cleaner output on the screen.
<P>
This option will also force the progress bar to be printed to <I>stderr</I> when
used alongside the <B>--output-file</B> option.
<DT id="52"><B>-N</B><DD>
<DT id="53"><B>--timestamping</B><DD>
Turn on time-stamping.
<DT id="54"><B>--no-if-modified-since</B><DD>
Do not send If-Modified-Since header in <B>-N</B> mode. Send preliminary <FONT SIZE="-1">HEAD</FONT>
request instead. This has only effect in <B>-N</B> mode.
<DT id="55"><B>--no-use-server-timestamps</B><DD>
Don't set the local file's timestamp by the one on the server.
<P>
By default, when a file is downloaded, its timestamps are set to
match those from the remote file. This allows the use of
<B>--timestamping</B> on subsequent invocations of wget. However, it
is sometimes useful to base the local file's timestamp on when it was
actually downloaded; for that purpose, the
<B>--no-use-server-timestamps</B> option has been provided.
<DT id="56"><B>-S</B><DD>
<DT id="57"><B>--server-response</B><DD>
Print the headers sent by <FONT SIZE="-1">HTTP</FONT> servers and responses sent by
<FONT SIZE="-1">FTP</FONT> servers.
<DT id="58"><B>--spider</B><DD>
When invoked with this option, Wget will behave as a Web <I>spider</I>,
which means that it will not download the pages, just check that they
are there. For example, you can use Wget to check your bookmarks:
<P>
<PRE>
wget --spider --force-html -i bookmarks.html
</PRE>
<P>
This feature needs much more work for Wget to get close to the
functionality of real web spiders.
<DT id="59"><B>-T seconds</B><DD>
<DT id="60"><B>--timeout=</B><I>seconds</I><DD>
Set the network timeout to <I>seconds</I> seconds. This is equivalent
to specifying <B>--dns-timeout</B>, <B>--connect-timeout</B>, and
<B>--read-timeout</B>, all at the same time.
<P>
When interacting with the network, Wget can check for timeout and
abort the operation if it takes too long. This prevents anomalies
like hanging reads and infinite connects. The only timeout enabled by
default is a 900-second read timeout. Setting a timeout to 0 disables
it altogether. Unless you know what you are doing, it is best not to
change the default timeout settings.
<P>
All timeout-related options accept decimal values, as well as
subsecond values. For example, <B>0.1</B> seconds is a legal (though
unwise) choice of timeout. Subsecond timeouts are useful for checking
server response times or for testing network latency.
<DT id="61"><B>--dns-timeout=</B><I>seconds</I><DD>
Set the <FONT SIZE="-1">DNS</FONT> lookup timeout to <I>seconds</I> seconds. <FONT SIZE="-1">DNS</FONT> lookups that
don't complete within the specified time will fail. By default, there
is no timeout on <FONT SIZE="-1">DNS</FONT> lookups, other than that implemented by system
libraries.
<DT id="62"><B>--connect-timeout=</B><I>seconds</I><DD>
Set the connect timeout to <I>seconds</I> seconds. <FONT SIZE="-1">TCP</FONT> connections that
take longer to establish will be aborted. By default, there is no
connect timeout, other than that implemented by system libraries.
<DT id="63"><B>--read-timeout=</B><I>seconds</I><DD>
Set the read (and write) timeout to <I>seconds</I> seconds. The
``time'' of this timeout refers to <I>idle time</I>: if, at any point in
the download, no data is received for more than the specified number
of seconds, reading fails and the download is restarted. This option
does not directly affect the duration of the entire download.
<P>
Of course, the remote server may choose to terminate the connection
sooner than this option requires. The default read timeout is 900
seconds.
<DT id="64"><B>--limit-rate=</B><I>amount</I><DD>
Limit the download speed to <I>amount</I> bytes per second. Amount may
be expressed in bytes, kilobytes with the <B>k</B> suffix, or megabytes
with the <B>m</B> suffix. For example, <B>--limit-rate=20k</B> will
limit the retrieval rate to 20KB/s. This is useful when, for whatever
reason, you don't want Wget to consume the entire available bandwidth.
<P>
This option allows the use of decimal numbers, usually in conjunction
with power suffixes; for example, <B>--limit-rate=2.5k</B> is a legal
value.
<P>
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 <FONT SIZE="-1">TCP</FONT> 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.
<DT id="65"><B>-w</B> <I>seconds</I><DD>
<DT id="66"><B>--wait=</B><I>seconds</I><DD>
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 <TT>&quot;m&quot;</TT> suffix, in hours using <TT>&quot;h&quot;</TT>
suffix, or in days using <TT>&quot;d&quot;</TT> suffix.
<P>
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
<TT>&quot;--random-wait&quot;</TT>, which see.
<DT id="67"><B>--waitretry=</B><I>seconds</I><DD>
If you don't want Wget to wait between <I>every</I> retrieval, but only
between retries of failed downloads, you can use this option. Wget will
use <I>linear backoff</I>, waiting 1 second after the first failure on a
given file, then waiting 2 seconds after the second failure on that
file, up to the maximum number of <I>seconds</I> you specify.
<P>
By default, Wget will assume a value of 10 seconds.
<DT id="68"><B>--random-wait</B><DD>
Some web sites may perform log analysis to identify retrieval programs
such as Wget by looking for statistically significant similarities in
the time between requests. This option causes the time between requests
to vary between 0.5 and 1.5 * <I>wait</I> seconds, where <I>wait</I> was
specified using the <B>--wait</B> option, in order to mask Wget's
presence from such analysis.
<P>
A 2001 article in a publication devoted to development on a popular
consumer platform provided code to perform this analysis on the fly.
Its author suggested blocking at the class C address level to ensure
automated retrieval programs were blocked despite changing DHCP-supplied
addresses.
<P>
The <B>--random-wait</B> option was inspired by this ill-advised
recommendation to block many unrelated users from a web site due to the
actions of one.
<DT id="69"><B>--no-proxy</B><DD>
Don't use proxies, even if the appropriate <TT>*_proxy</TT> environment
variable is defined.
<DT id="70"><B>-Q</B> <I>quota</I><DD>
<DT id="71"><B>--quota=</B><I>quota</I><DD>
Specify download quota for automatic retrievals. The value can be
specified in bytes (default), kilobytes (with <B>k</B> suffix), or
megabytes (with <B>m</B> suffix).
<P>
Note that quota will never affect downloading a single file. So if you
specify <B>wget -Q10k <A HREF="https://example.com/ls-lR.gz">https://example.com/ls-lR.gz</A></B>, all of the
<I>ls-lR.gz</I> will be downloaded. 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 <B>wget -Q2m -i sites</B>---download will be
aborted when the quota is exceeded.
<P>
Setting quota to 0 or to <B>inf</B> unlimits the download quota.
<DT id="72"><B>--no-dns-cache</B><DD>
Turn off caching of <FONT SIZE="-1">DNS</FONT> lookups. Normally, Wget remembers the <FONT SIZE="-1">IP</FONT>
addresses it looked up from <FONT SIZE="-1">DNS</FONT> so it doesn't have to repeatedly
contact the <FONT SIZE="-1">DNS</FONT> server for the same (typically small) set of hosts it
retrieves from. This cache exists in memory only; a new Wget run will
contact <FONT SIZE="-1">DNS</FONT> again.
<P>
However, it has been reported that in some situations it is not
desirable to cache host names, even for the duration of a
short-running application like Wget. With this option Wget issues a
new <FONT SIZE="-1">DNS</FONT> lookup (more precisely, a new call to <TT>&quot;gethostbyname&quot;</TT> or
<TT>&quot;getaddrinfo&quot;</TT>) each time it makes a new connection. Please note
that this option will <I>not</I> affect caching that might be
performed by the resolving library or by an external caching layer,
such as <FONT SIZE="-1">NSCD.</FONT>
<P>
If you don't understand exactly what this option does, you probably
won't need it.
<DT id="73"><B>--restrict-file-names=</B><I>modes</I><DD>
Change which characters found in remote URLs must be escaped during
generation of local filenames. Characters that are <I>restricted</I>
by this option are escaped, i.e. replaced with <B></B>%HH<B></B>, where
<B></B><FONT SIZE="-1"><B>HH</B></FONT><B></B> is the hexadecimal number that corresponds to the restricted
character. This option may also be used to force all alphabetical
cases to be either lower- or uppercase.
<P>
By default, Wget escapes the characters that are not valid or safe as
part of file names on your operating system, as well as control
characters that are typically unprintable. This option is useful for
changing these defaults, perhaps because you are downloading to a
non-native partition, or because you want to disable escaping of the
control characters, or you want to further restrict characters to only
those in the <FONT SIZE="-1">ASCII</FONT> range of values.
<P>
The <I>modes</I> are a comma-separated set of text values. The
acceptable values are <B>unix</B>, <B>windows</B>, <B>nocontrol</B>,
<B>ascii</B>, <B>lowercase</B>, and <B>uppercase</B>. The values
<B>unix</B> and <B>windows</B> are mutually exclusive (one will
override the other), as are <B>lowercase</B> and
<B>uppercase</B>. 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.
<P>
When ``unix'' is specified, Wget escapes the character <B>/</B> and
the control characters in the ranges 0--31 and 128--159. This is the
default on Unix-like operating systems.
<P>
When ``windows'' is given, Wget escapes the characters <B>\</B>,
<B>|</B>, <B>/</B>, <B>:</B>, <B>?</B>, <B>&quot;</B>, <B>*</B>, <B>&lt;</B>,
<B>&gt;</B>, and the control characters in the ranges 0--31 and 128--159.
In addition to this, Wget in Windows mode uses <B>+</B> instead of
<B>:</B> to separate host and port in local file names, and uses
<B>@</B> instead of <B>?</B> to separate the query portion of the file
name from the rest. Therefore, a <FONT SIZE="-1">URL</FONT> that would be saved as
<B><A HREF="http://www.xemacs.org">www.xemacs.org</A>:4300/search.pl?input=blah</B> in Unix mode would be
saved as <B><A HREF="http://www.xemacs.org+4300">www.xemacs.org+4300</A>/<A HREF="mailto:search.pl@input">search.pl@input</A>=blah</B> in Windows
mode. This mode is the default on Windows.
<P>
If you specify <B>nocontrol</B>, then the escaping of the control
characters is also switched off. This option may make sense
when you are downloading URLs whose names contain <FONT SIZE="-1">UTF-8</FONT> characters, on
a system which can save and display filenames in <FONT SIZE="-1">UTF-8</FONT> (some possible
byte values used in <FONT SIZE="-1">UTF-8</FONT> byte sequences fall in the range of values
designated by Wget as ``controls'').
<P>
The <B>ascii</B> mode is used to specify that any bytes whose values
are outside the range of <FONT SIZE="-1">ASCII</FONT> characters (that is, greater than
127) shall be escaped. This can be useful when saving filenames
whose encoding does not match the one used locally.
<DT id="74"><B>-4</B><DD>
<DT id="75"><B>--inet4-only</B><DD>
<DT id="76"><B>-6</B><DD>
<DT id="77"><B>--inet6-only</B><DD>
Force connecting to IPv4 or IPv6 addresses. With <B>--inet4-only</B>
or <B>-4</B>, Wget will only connect to IPv4 hosts, ignoring <FONT SIZE="-1">AAAA</FONT>
records in <FONT SIZE="-1">DNS,</FONT> and refusing to connect to IPv6 addresses specified in
URLs. Conversely, with <B>--inet6-only</B> or <B>-6</B>, Wget will
only connect to IPv6 hosts and ignore A records and IPv4 addresses.
<P>
Neither options should be needed normally. By default, an IPv6-aware
Wget will use the address family specified by the host's <FONT SIZE="-1">DNS</FONT> record.
If the <FONT SIZE="-1">DNS</FONT> responds with both IPv4 and IPv6 addresses, Wget will try
them in sequence until it finds one it can connect to. (Also see
<TT>&quot;--prefer-family&quot;</TT> option described below.)
<P>
These options can be used to deliberately force the use of IPv4 or
IPv6 address families on dual family systems, usually to aid debugging
or to deal with broken network configuration. Only one of
<B>--inet6-only</B> and <B>--inet4-only</B> may be specified at the
same time. Neither option is available in Wget compiled without IPv6
support.
<DT id="78"><B>--prefer-family=none/IPv4/IPv6</B><DD>
When given a choice of several addresses, connect to the addresses
with specified address family first. The address order returned by
<FONT SIZE="-1">DNS</FONT> is used without change by default.
<P>
This avoids spurious errors and connect attempts when accessing hosts
that resolve to both IPv6 and IPv4 addresses from IPv4 networks. For
example, <B><A HREF="http://www.kame.net">www.kame.net</A></B> resolves to
<B>2001:200:0:8002:203:47ff:fea5:3085</B> and to
<B>203.178.141.194</B>. When the preferred family is <TT>&quot;IPv4&quot;</TT>, the
IPv4 address is used first; when the preferred family is <TT>&quot;IPv6&quot;</TT>,
the IPv6 address is used first; if the specified value is <TT>&quot;none&quot;</TT>,
the address order returned by <FONT SIZE="-1">DNS</FONT> is used without change.
<P>
Unlike <B>-4</B> and <B>-6</B>, this option doesn't inhibit access to
any address family, it only changes the <I>order</I> in which the
addresses are accessed. Also note that the reordering performed by
this option is <I>stable</I>---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.
<DT id="79"><B>--retry-connrefused</B><DD>
Consider ``connection refused'' a transient error and try again.
Normally Wget gives up on a <FONT SIZE="-1">URL</FONT> when it is unable to 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.
<DT id="80"><B>--user=</B><I>user</I><DD>
<DT id="81"><B>--password=</B><I>password</I><DD>
Specify the username <I>user</I> and password <I>password</I> for both
<FONT SIZE="-1">FTP</FONT> and <FONT SIZE="-1">HTTP</FONT> file retrieval. These parameters can be overridden
using the <B>--ftp-user</B> and <B>--ftp-password</B> options for
<FONT SIZE="-1">FTP</FONT> connections and the <B>--http-user</B> and <B>--http-password</B>
options for <FONT SIZE="-1">HTTP</FONT> connections.
<DT id="82"><B>--ask-password</B><DD>
Prompt for a password for each connection established. Cannot be specified
when <B>--password</B> is being used, because they are mutually exclusive.
<DT id="83"><B>--use-askpass=</B><I>command</I><DD>
Prompt for a user and password using the specified command. If no command is
specified then the command in the environment variable <FONT SIZE="-1">WGET_ASKPASS</FONT> is used.
If <FONT SIZE="-1">WGET_ASKPASS</FONT> is not set then the command in the environment variable
<FONT SIZE="-1">SSH_ASKPASS</FONT> is used.
<P>
You can set the default command for use-askpass in the <I>.wgetrc</I>. That
setting may be overridden from the command line.
<DT id="84"><B>--no-iri</B><DD>
Turn off internationalized <FONT SIZE="-1">URI</FONT> (<FONT SIZE="-1">IRI</FONT>) support. Use <B>--iri</B> to
turn it on. <FONT SIZE="-1">IRI</FONT> support is activated by default.
<P>
You can set the default state of <FONT SIZE="-1">IRI</FONT> support using the <TT>&quot;iri&quot;</TT>
command in <I>.wgetrc</I>. That setting may be overridden from the
command line.
<DT id="85"><B>--local-encoding=</B><I>encoding</I><DD>
Force Wget to use <I>encoding</I> as the default system encoding. That affects
how Wget converts URLs specified as arguments from locale to <FONT SIZE="-1">UTF-8</FONT> for
<FONT SIZE="-1">IRI</FONT> support.
<P>
Wget use the function <TT>&quot;nl_langinfo()&quot;</TT> and then the <TT>&quot;CHARSET&quot;</TT>
environment variable to get the locale. If it fails, <FONT SIZE="-1">ASCII</FONT> is used.
<P>
You can set the default local encoding using the <TT>&quot;local_encoding&quot;</TT>
command in <I>.wgetrc</I>. That setting may be overridden from the
command line.
<DT id="86"><B>--remote-encoding=</B><I>encoding</I><DD>
Force Wget to use <I>encoding</I> as the default remote server encoding.
That affects how Wget converts URIs found in files from remote encoding
to <FONT SIZE="-1">UTF-8</FONT> during a recursive fetch. This options is only useful for
<FONT SIZE="-1">IRI</FONT> support, for the interpretation of non-ASCII characters.
<P>
For <FONT SIZE="-1">HTTP,</FONT> remote encoding can be found in <FONT SIZE="-1">HTTP</FONT> <TT>&quot;Content-Type&quot;</TT>
header and in <FONT SIZE="-1">HTML</FONT> <TT>&quot;Content-Type http-equiv&quot;</TT> meta tag.
<P>
You can set the default encoding using the <TT>&quot;remoteencoding&quot;</TT>
command in <I>.wgetrc</I>. That setting may be overridden from the
command line.
<DT id="87"><B>--unlink</B><DD>
Force Wget to unlink file instead of clobbering existing file. This
option is useful for downloading to the directory with hardlinks.
</DL>
<A NAME="lbAJ">&nbsp;</A>
<H3>Directory Options</H3>
<DL COMPACT>
<DT id="88"><B>-nd</B><DD>
<DT id="89"><B>--no-directories</B><DD>
Do not create a hierarchy of directories when retrieving recursively.
With this option turned on, all files will get saved to the current
directory, without clobbering (if a name shows up more than once, the
filenames will get extensions <B>.n</B>).
<DT id="90"><B>-x</B><DD>
<DT id="91"><B>--force-directories</B><DD>
The opposite of <B>-nd</B>---create a hierarchy of directories, even if
one would not have been created otherwise. E.g. <B>wget -x
<A HREF="http://fly.srk.fer.hr/robots.txt">http://fly.srk.fer.hr/robots.txt</A></B> will save the downloaded file to
<I>fly.srk.fer.hr/robots.txt</I>.
<DT id="92"><B>-nH</B><DD>
<DT id="93"><B>--no-host-directories</B><DD>
Disable generation of host-prefixed directories. By default, invoking
Wget with <B>-r <A HREF="http://fly.srk.fer.hr/">http://fly.srk.fer.hr/</A></B> will create a structure of
directories beginning with <I>fly.srk.fer.hr/</I>. This option disables
such behavior.
<DT id="94"><B>--protocol-directories</B><DD>
Use the protocol name as a directory component of local file names. For
example, with this option, <B>wget -r http://</B><I>host</I> will save to
<B>http/</B><I>host</I><B>/...</B> rather than just to <I>host</I><B>/...</B>.
<DT id="95"><B>--cut-dirs=</B><I>number</I><DD>
Ignore <I>number</I> directory components. This is useful for getting a
fine-grained control over the directory where recursive retrieval will
be saved.
<P>
Take, for example, the directory at
<B><A HREF="ftp://ftp.xemacs.org/pub/xemacs/">ftp://ftp.xemacs.org/pub/xemacs/</A></B>. If you retrieve it with
<B>-r</B>, it will be saved locally under
<I><A HREF="ftp://ftp.xemacs.org">ftp.xemacs.org</A>/pub/xemacs/</I>. While the <B>-nH</B> option can
remove the <I><A HREF="ftp://ftp.xemacs.org">ftp.xemacs.org</A>/</I> part, you are still stuck with
<I>pub/xemacs</I>. This is where <B>--cut-dirs</B> comes in handy; it
makes Wget not ``see'' <I>number</I> remote directory components. Here
are several examples of how <B>--cut-dirs</B> option works.
<P>
<PRE>
No options -&gt; <A HREF="ftp://ftp.xemacs.org">ftp.xemacs.org</A>/pub/xemacs/
-nH -&gt; pub/xemacs/
-nH --cut-dirs=1 -&gt; xemacs/
-nH --cut-dirs=2 -&gt; .
--cut-dirs=1 -&gt; <A HREF="ftp://ftp.xemacs.org">ftp.xemacs.org</A>/xemacs/
...
</PRE>
<P>
If you just want to get rid of the directory structure, this option is
similar to a combination of <B>-nd</B> and <B>-P</B>. However, unlike
<B>-nd</B>, <B>--cut-dirs</B> does not lose with subdirectories---for
instance, with <B>-nH --cut-dirs=1</B>, a <I>beta/</I> subdirectory will
be placed to <I>xemacs/beta</I>, as one would expect.
<DT id="96"><B>-P</B> <I>prefix</I><DD>
<DT id="97"><B>--directory-prefix=</B><I>prefix</I><DD>
Set directory prefix to <I>prefix</I>. The <I>directory prefix</I> is the
directory where all other files and subdirectories will be saved to,
i.e. the top of the retrieval tree. The default is <B>.</B> (the
current directory).
</DL>
<A NAME="lbAK">&nbsp;</A>
<H3><FONT SIZE="-1">HTTP</FONT> Options</H3>
<DL COMPACT>
<DT id="98"><B>--default-page=</B><I>name</I><DD>
Use <I>name</I> as the default file name when it isn't known (i.e., for
URLs that end in a slash), instead of <I>index.html</I>.
<DT id="99"><B>-E</B><DD>
<DT id="100"><B>--adjust-extension</B><DD>
If a file of type <B>application/xhtml+xml</B> or <B>text/html</B> is
downloaded and the <FONT SIZE="-1">URL</FONT> does not end with the regexp
<B>\.[Hh][Tt][Mm][Ll]?</B>, this option will cause the suffix <B>.html</B>
to be appended to the local filename. This is useful, for instance, when
you're mirroring a remote site that uses <B>.asp</B> pages, but you want
the mirrored pages to be viewable on your stock Apache server. Another
good use for this is when you're downloading CGI-generated materials. A <FONT SIZE="-1">URL</FONT>
like <B><A HREF="http://site.com/article.cgi?25">http://site.com/article.cgi?25</A></B> will be saved as
<I>article.cgi?25.html</I>.
<P>
Note that filenames changed in this way will be re-downloaded every time
you re-mirror a site, because Wget can't tell that the local
<I>X.html</I> file corresponds to remote <FONT SIZE="-1">URL</FONT> <I>X</I> (since
it doesn't yet know that the <FONT SIZE="-1">URL</FONT> produces output of type
<B>text/html</B> or <B>application/xhtml+xml</B>.
<P>
As of version 1.12, Wget will also ensure that any downloaded files of
type <B>text/css</B> end in the suffix <B>.css</B>, and the option was
renamed from <B>--html-extension</B>, to better reflect its new
behavior. The old option name is still acceptable, but should now be
considered deprecated.
<P>
As of version 1.19.2, Wget will also ensure that any downloaded files with
a <TT>&quot;Content-Encoding&quot;</TT> of <B>br</B>, <B>compress</B>, <B>deflate</B>
or <B>gzip</B> end in the suffix <B>.br</B>, <B>.Z</B>, <B>.zlib</B>
and <B>.gz</B> respectively.
<P>
At some point in the future, this option may well be expanded to
include suffixes for other types of content, including content types
that are not parsed by Wget.
<DT id="101"><B>--http-user=</B><I>user</I><DD>
<DT id="102"><B>--http-password=</B><I>password</I><DD>
Specify the username <I>user</I> and password <I>password</I> on an
<FONT SIZE="-1">HTTP</FONT> server. According to the type of the challenge, Wget will
encode them using either the <TT>&quot;basic&quot;</TT> (insecure),
the <TT>&quot;digest&quot;</TT>, or the Windows <TT>&quot;NTLM&quot;</TT> authentication scheme.
<P>
Another way to specify username and password is in the <FONT SIZE="-1">URL</FONT> itself. Either method reveals your password to anyone who
bothers to run <TT>&quot;ps&quot;</TT>. To prevent the passwords from being seen,
use the <B>--use-askpass</B> or store them in <I>.wgetrc</I> or <I>.netrc</I>,
and make sure to protect those files from other users with <TT>&quot;chmod&quot;</TT>. If
the passwords are really important, do not leave them lying in those files
either---edit the files and delete them after Wget has started the download.
<DT id="103"><B>--no-http-keep-alive</B><DD>
Turn off the ``keep-alive'' feature for <FONT SIZE="-1">HTTP</FONT> downloads. Normally, Wget
asks the server to keep the connection open so that, when you download
more than one document from the same server, they get transferred over
the same <FONT SIZE="-1">TCP</FONT> connection. This saves time and at the same time reduces
the load on the server.
<P>
This option is useful when, for some reason, persistent (keep-alive)
connections don't work for you, for example due to a server bug or due
to the inability of server-side scripts to cope with the connections.
<DT id="104"><B>--no-cache</B><DD>
Disable server-side cache. In this case, Wget will send the remote
server appropriate directives (<B>Cache-Control: no-cache</B> and
<B>Pragma: no-cache</B>) to get the file from the remote service,
rather than returning the cached version. This is especially useful
for retrieving and flushing out-of-date documents on proxy servers.
<P>
Caching is allowed by default.
<DT id="105"><B>--no-cookies</B><DD>
Disable the use of cookies. Cookies are a mechanism for maintaining
server-side state. The server sends the client a cookie using the
<TT>&quot;Set-Cookie&quot;</TT> header, and the client responds with the same cookie
upon further requests. Since cookies allow the server owners to keep
track of visitors and for sites to exchange this information, some
consider them a breach of privacy. The default is to use cookies;
however, <I>storing</I> cookies is not on by default.
<DT id="106"><B>--load-cookies</B> <I>file</I><DD>
Load cookies from <I>file</I> before the first <FONT SIZE="-1">HTTP</FONT> retrieval.
<I>file</I> is a textual file in the format originally used by Netscape's
<I>cookies.txt</I> file.
<P>
You will typically use this option when mirroring sites that require
that you be logged in to access some or all of their content. The login
process typically works by the web server issuing an <FONT SIZE="-1">HTTP</FONT> cookie
upon receiving and verifying your credentials. The cookie is then
resent by the browser when accessing that part of the site, and so
proves your identity.
<P>
Mirroring such a site requires Wget to send the same cookies your
browser sends when communicating with the site. This is achieved by
<B>--load-cookies</B>---simply point Wget to the location of the
<I>cookies.txt</I> file, and it will send the same cookies your browser
would send in the same situation. Different browsers keep textual
cookie files in different locations:
<DL COMPACT><DT id="107"><DD>
<DL COMPACT>
<DT id="108">&quot;Netscape 4.x.&quot;<DD>
The cookies are in <I>~/.netscape/cookies.txt</I>.
<DT id="109">&quot;Mozilla and Netscape 6.x.&quot;<DD>
Mozilla's cookie file is also named <I>cookies.txt</I>, located
somewhere under <I>~/.mozilla</I>, in the directory of your profile.
The full path usually ends up looking somewhat like
<I>~/.mozilla/default/some-weird-string/cookies.txt</I>.
<DT id="110">&quot;Internet Explorer.&quot;<DD>
You can produce a cookie file Wget can use by using the File menu,
Import and Export, Export Cookies. This has been tested with Internet
Explorer 5; it is not guaranteed to work with earlier versions.
<DT id="111">&quot;Other browsers.&quot;<DD>
If you are using a different browser to create your cookies,
<B>--load-cookies</B> will only work if you can locate or produce a
cookie file in the Netscape format that Wget expects.
</DL>
</DL>
<DL COMPACT><DT id="112"><DD>
<P>
If you cannot use <B>--load-cookies</B>, there might still be an
alternative. If your browser supports a ``cookie manager'', you can use
it to view the cookies used when accessing the site you're mirroring.
Write down the name and value of the cookie, and manually instruct Wget
to send those cookies, bypassing the ``official'' cookie support:
<P>
<PRE>
wget --no-cookies --header &quot;Cookie: &lt;name&gt;=&lt;value&gt;&quot;
</PRE>
</DL>
<DT id="113"><B>--save-cookies</B> <I>file</I><DD>
Save cookies to <I>file</I> before exiting. This will not save cookies
that have expired or that have no expiry time (so-called ``session
cookies''), but also see <B>--keep-session-cookies</B>.
<DT id="114"><B>--keep-session-cookies</B><DD>
When specified, causes <B>--save-cookies</B> to also save session
cookies. Session cookies are normally not saved because they are
meant to be kept in memory and forgotten when you exit the browser.
Saving them is useful on sites that require you to log in or to visit
the home page before you can access some pages. With this option,
multiple Wget runs are considered a single browser session as far as
the site is concerned.
<P>
Since the cookie file format does not normally carry session cookies,
Wget marks them with an expiry timestamp of 0. Wget's
<B>--load-cookies</B> recognizes those as session cookies, but it might
confuse other browsers. Also note that cookies so loaded will be
treated as other session cookies, which means that if you want
<B>--save-cookies</B> to preserve them again, you must use
<B>--keep-session-cookies</B> again.
<DT id="115"><B>--ignore-length</B><DD>
Unfortunately, some <FONT SIZE="-1">HTTP</FONT> servers (<FONT SIZE="-1">CGI</FONT> programs, to be more
precise) send out bogus <TT>&quot;Content-Length&quot;</TT> headers, which makes Wget
go wild, as it thinks not all the document was retrieved. You can spot
this syndrome if Wget retries getting the same document again and again,
each time claiming that the (otherwise normal) connection has closed on
the very same byte.
<P>
With this option, Wget will ignore the <TT>&quot;Content-Length&quot;</TT> header---as
if it never existed.
<DT id="116"><B>--header=</B><I>header-line</I><DD>
Send <I>header-line</I> along with the rest of the headers in each
<FONT SIZE="-1">HTTP</FONT> request. The supplied header is sent as-is, which means it
must contain name and value separated by colon, and must not contain
newlines.
<P>
You may define more than one additional header by specifying
<B>--header</B> more than once.
<P>
<PRE>
wget --header='Accept-Charset: iso-8859-2' \
--header='Accept-Language: hr' \
<A HREF="http://fly.srk.fer.hr/">http://fly.srk.fer.hr/</A>
</PRE>
<P>
Specification of an empty string as the header value will clear all
previous user-defined headers.
<P>
As of Wget 1.10, this option can be used to override headers otherwise
generated automatically. This example instructs Wget to connect to
localhost, but to specify <B>foo.bar</B> in the <TT>&quot;Host&quot;</TT> header:
<P>
<PRE>
wget --header=&quot;Host: foo.bar&quot; <A HREF="http://localhost/">http://localhost/</A>
</PRE>
<P>
In versions of Wget prior to 1.10 such use of <B>--header</B> caused
sending of duplicate headers.
<DT id="117"><B>--compression=</B><I>type</I><DD>
Choose the type of compression to be used. Legal values are
<B>auto</B>, <B>gzip</B> and <B>none</B>.
<P>
If <B>auto</B> or <B>gzip</B> are specified, Wget asks the server to
compress the file using the gzip compression format. If the server
compresses the file and responds with the <TT>&quot;Content-Encoding&quot;</TT>
header field set appropriately, the file will be decompressed
automatically.
<P>
If <B>none</B> is specified, wget will not ask the server to compress
the file and will not decompress any server responses. This is the default.
<P>
Compression support is currently experimental. In case it is turned on,
please report any bugs to <TT>&quot;<A HREF="mailto:bug-wget@gnu.org">bug-wget@gnu.org</A>&quot;</TT>.
<DT id="118"><B>--max-redirect=</B><I>number</I><DD>
Specifies the maximum number of redirections to follow for a resource.
The default is 20, which is usually far more than necessary. However, on
those occasions where you want to allow more (or fewer), this is the
option to use.
<DT id="119"><B>--proxy-user=</B><I>user</I><DD>
<DT id="120"><B>--proxy-password=</B><I>password</I><DD>
Specify the username <I>user</I> and password <I>password</I> for
authentication on a proxy server. Wget will encode them using the
<TT>&quot;basic&quot;</TT> authentication scheme.
<P>
Security considerations similar to those with <B>--http-password</B>
pertain here as well.
<DT id="121"><B>--referer=</B><I>url</I><DD>
Include `Referer: <I>url</I>' header in <FONT SIZE="-1">HTTP</FONT> request. Useful for
retrieving documents with server-side processing that assume they are
always being retrieved by interactive web browsers and only come out
properly when Referer is set to one of the pages that point to them.
<DT id="122"><B>--save-headers</B><DD>
Save the headers sent by the <FONT SIZE="-1">HTTP</FONT> server to the file, preceding the
actual contents, with an empty line as the separator.
<DT id="123"><B>-U</B> <I>agent-string</I><DD>
<DT id="124"><B>--user-agent=</B><I>agent-string</I><DD>
Identify as <I>agent-string</I> to the <FONT SIZE="-1">HTTP</FONT> server.
<P>
The <FONT SIZE="-1">HTTP</FONT> protocol allows the clients to identify themselves using a
<TT>&quot;User-Agent&quot;</TT> header field. This enables distinguishing the
<FONT SIZE="-1">WWW</FONT> software, usually for statistical purposes or for tracing of
protocol violations. Wget normally identifies as
<B>Wget/</B><I>version</I>, <I>version</I> being the current version
number of Wget.
<P>
However, some sites have been known to impose the policy of tailoring
the output according to the <TT>&quot;User-Agent&quot;</TT>-supplied information.
While this is not such a bad idea in theory, it has been abused by
servers denying information to clients other than (historically)
Netscape or, more frequently, Microsoft Internet Explorer. This
option allows you to change the <TT>&quot;User-Agent&quot;</TT> line issued by Wget.
Use of this option is discouraged, unless you really know what you are
doing.
<P>
Specifying empty user agent with <B>--user-agent=&quot;&quot;</B> instructs Wget
not to send the <TT>&quot;User-Agent&quot;</TT> header in <FONT SIZE="-1">HTTP</FONT> requests.
<DT id="125"><B>--post-data=</B><I>string</I><DD>
<DT id="126"><B>--post-file=</B><I>file</I><DD>
Use <FONT SIZE="-1">POST</FONT> as the method for all <FONT SIZE="-1">HTTP</FONT> requests and send the specified
data in the request body. <B>--post-data</B> sends <I>string</I> as
data, whereas <B>--post-file</B> sends the contents of <I>file</I>.
Other than that, they work in exactly the same way. In particular,
they <I>both</I> expect content of the form <TT>&quot;key1=value1&amp;key2=value2&quot;</TT>,
with percent-encoding for special characters; the only difference is
that one expects its content as a command-line parameter and the other
accepts its content from a file. In particular, <B>--post-file</B> is
<I>not</I> for transmitting files as form attachments: those must
appear as <TT>&quot;key=value&quot;</TT> data (with appropriate percent-coding) just
like everything else. Wget does not currently support
<TT>&quot;multipart/form-data&quot;</TT> for transmitting <FONT SIZE="-1">POST</FONT> data; only
<TT>&quot;application/x-www-form-urlencoded&quot;</TT>. Only one of
<B>--post-data</B> and <B>--post-file</B> should be specified.
<P>
Please note that wget does not require the content to be of the form
<TT>&quot;key1=value1&amp;key2=value2&quot;</TT>, and neither does it test for it. Wget will
simply transmit whatever data is provided to it. Most servers however expect
the <FONT SIZE="-1">POST</FONT> data to be in the above format when processing <FONT SIZE="-1">HTML</FONT> Forms.
<P>
When sending a <FONT SIZE="-1">POST</FONT> request using the <B>--post-file</B> option, Wget treats
the file as a binary file and will send every character in the <FONT SIZE="-1">POST</FONT> request
without stripping trailing newline or formfeed characters. Any other control
characters in the text will also be sent as-is in the <FONT SIZE="-1">POST</FONT> request.
<P>
Please be aware that Wget needs to know the size of the <FONT SIZE="-1">POST</FONT> data in
advance. Therefore the argument to <TT>&quot;--post-file&quot;</TT> must be a regular
file; specifying a <FONT SIZE="-1">FIFO</FONT> or something like <I>/dev/stdin</I> won't work.
It's not quite clear how to work around this limitation inherent in
<FONT SIZE="-1">HTTP/1.0.</FONT> Although <FONT SIZE="-1">HTTP/1.1</FONT> introduces <I>chunked</I> transfer that
doesn't require knowing the request length in advance, a client can't
use chunked unless it knows it's talking to an <FONT SIZE="-1">HTTP/1.1</FONT> server. And it
can't know that until it receives a response, which in turn requires the
request to have been completed --- a chicken-and-egg problem.
<P>
Note: As of version 1.15 if Wget is redirected after the <FONT SIZE="-1">POST</FONT> request is
completed, its behaviour will depend on the response code returned by the
server. In case of a 301 Moved Permanently, 302 Moved Temporarily or
307 Temporary Redirect, Wget will, in accordance with <FONT SIZE="-1">RFC2616,</FONT> continue
to send a <FONT SIZE="-1">POST</FONT> request.
In case a server wants the client to change the Request method upon
redirection, it should send a 303 See Other response code.
<P>
This example shows how to log in to a server using <FONT SIZE="-1">POST</FONT> and then proceed to
download the desired pages, presumably only accessible to authorized
users:
<P>
<PRE>
# Log in to the server. This can be done only once.
wget --save-cookies cookies.txt \
--post-data 'user=foo&amp;password=bar' \
<A HREF="http://example.com/auth.php">http://example.com/auth.php</A>
# Now grab the page or pages we care about.
wget --load-cookies cookies.txt \
-p <A HREF="http://example.com/interesting/article.php">http://example.com/interesting/article.php</A>
</PRE>
<P>
If the server is using session cookies to track user authentication,
the above will not work because <B>--save-cookies</B> will not save
them (and neither will browsers) and the <I>cookies.txt</I> file will
be empty. In that case use <B>--keep-session-cookies</B> along with
<B>--save-cookies</B> to force saving of session cookies.
<DT id="127"><B>--method=</B><I>HTTP-Method</I><DD>
For the purpose of RESTful scripting, Wget allows sending of other <FONT SIZE="-1">HTTP</FONT> Methods
without the need to explicitly set them using <B>--header=Header-Line</B>.
Wget will use whatever string is passed to it after <B>--method</B> as the <FONT SIZE="-1">HTTP</FONT>
Method to the server.
<DT id="128"><B>--body-data=</B><I>Data-String</I><DD>
<DT id="129"><B>--body-file=</B><I>Data-File</I><DD>
Must be set when additional data needs to be sent to the server along with the
Method specified using <B>--method</B>. <B>--body-data</B> sends <I>string</I> as
data, whereas <B>--body-file</B> sends the contents of <I>file</I>. Other than that,
they work in exactly the same way.
<P>
Currently, <B>--body-file</B> is <I>not</I> for transmitting files as a whole.
Wget does not currently support <TT>&quot;multipart/form-data&quot;</TT> for transmitting data;
only <TT>&quot;application/x-www-form-urlencoded&quot;</TT>. In the future, this may be changed
so that wget sends the <B>--body-file</B> as a complete file instead of sending its
contents to the server. Please be aware that Wget needs to know the contents of
<FONT SIZE="-1">BODY</FONT> Data in advance, and hence the argument to <B>--body-file</B> should be a
regular file. See <B>--post-file</B> for a more detailed explanation.
Only one of <B>--body-data</B> and <B>--body-file</B> should be specified.
<P>
If Wget is redirected after the request is completed, Wget will
suspend the current method and send a <FONT SIZE="-1">GET</FONT> request till the redirection
is completed. This is true for all redirection response codes except
307 Temporary Redirect which is used to explicitly specify that the
request method should <I>not</I> change. Another exception is when
the method is set to <TT>&quot;POST&quot;</TT>, in which case the redirection rules
specified under <B>--post-data</B> are followed.
<DT id="130"><B>--content-disposition</B><DD>
If this is set to on, experimental (not fully-functional) support for
<TT>&quot;Content-Disposition&quot;</TT> headers is enabled. This can currently result in
extra round-trips to the server for a <TT>&quot;HEAD&quot;</TT> request, and is known
to suffer from a few bugs, which is why it is not currently enabled by default.
<P>
This option is useful for some file-downloading <FONT SIZE="-1">CGI</FONT> programs that use
<TT>&quot;Content-Disposition&quot;</TT> headers to describe what the name of a
downloaded file should be.
<P>
When combined with <B>--metalink-over-http</B> and <B>--trust-server-names</B>,
a <B>Content-Type: application/metalink4+xml</B> file is named using the
<TT>&quot;Content-Disposition&quot;</TT> filename field, if available.
<DT id="131"><B>--content-on-error</B><DD>
If this is set to on, wget will not skip the content when the server responds
with a http status code that indicates error.
<DT id="132"><B>--trust-server-names</B><DD>
If this is set, on a redirect, the local file name will be based
on the redirection <FONT SIZE="-1">URL.</FONT> By default the local file name is based on
the original <FONT SIZE="-1">URL.</FONT> When doing recursive retrieving this can be helpful
because in many web sites redirected URLs correspond to an underlying
file structure, while link URLs do not.
<DT id="133"><B>--auth-no-challenge</B><DD>
If this option is given, Wget will send Basic <FONT SIZE="-1">HTTP</FONT> authentication
information (plaintext username and password) for all requests, just
like Wget 1.10.2 and prior did by default.
<P>
Use of this option is not recommended, and is intended only to support
some few obscure servers, which never send <FONT SIZE="-1">HTTP</FONT> authentication
challenges, but accept unsolicited auth info, say, in addition to
form-based authentication.
<DT id="134"><B>--retry-on-host-error</B><DD>
Consider host errors, such as ``Temporary failure in name resolution'',
as non-fatal, transient errors.
<DT id="135"><B>--retry-on-http-error=</B><I>code[,code,...]</I><DD>
Consider given <FONT SIZE="-1">HTTP</FONT> response codes as non-fatal, transient errors.
Supply a comma-separated list of 3-digit <FONT SIZE="-1">HTTP</FONT> response codes as
argument. Useful to work around special circumstances where retries
are required, but the server responds with an error code normally not
retried by Wget. Such errors might be 503 (Service Unavailable) and
429 (Too Many Requests). Retries enabled by this option are performed
subject to the normal retry timing and retry count limitations of
Wget.
<P>
Using this option is intended to support special use cases only and is
generally not recommended, as it can force retries even in cases where
the server is actually trying to decrease its load. Please use wisely
and only if you know what you are doing.
</DL>
<A NAME="lbAL">&nbsp;</A>
<H3><FONT SIZE="-1">HTTPS</FONT> (<FONT SIZE="-1">SSL/TLS</FONT>) Options</H3>
To support encrypted <FONT SIZE="-1">HTTP</FONT> (<FONT SIZE="-1">HTTPS</FONT>) downloads, Wget must be compiled
with an external <FONT SIZE="-1">SSL</FONT> library. The current default is GnuTLS.
In addition, Wget also supports <FONT SIZE="-1">HSTS</FONT> (<FONT SIZE="-1">HTTP</FONT> Strict Transport Security).
If Wget is compiled without <FONT SIZE="-1">SSL</FONT> support, none of these options are available.
<DL COMPACT>
<DT id="136"><B>--secure-protocol=</B><I>protocol</I><DD>
Choose the secure protocol to be used. Legal values are <B>auto</B>,
<B>SSLv2</B>, <B>SSLv3</B>, <B>TLSv1</B>, <B>TLSv1_1</B>, <B>TLSv1_2</B>,
<B>TLSv1_3</B> and <B></B><FONT SIZE="-1"><B>PFS</B></FONT><B></B>. If <B>auto</B> is used, the <FONT SIZE="-1">SSL</FONT> library is
given the liberty of choosing the appropriate protocol automatically, which is
achieved by sending a TLSv1 greeting. This is the default.
<P>
Specifying <B>SSLv2</B>, <B>SSLv3</B>, <B>TLSv1</B>, <B>TLSv1_1</B>,
<B>TLSv1_2</B> or <B>TLSv1_3</B> forces the use of the corresponding
protocol. This is useful when talking to old and buggy <FONT SIZE="-1">SSL</FONT> server
implementations that make it hard for the underlying <FONT SIZE="-1">SSL</FONT> library to choose
the correct protocol version. Fortunately, such servers are quite rare.
<P>
Specifying <B></B><FONT SIZE="-1"><B>PFS</B></FONT><B></B> enforces the use of the so-called Perfect Forward
Security cipher suites. In short, <FONT SIZE="-1">PFS</FONT> adds security by creating a one-time
key for each <FONT SIZE="-1">SSL</FONT> connection. It has a bit more <FONT SIZE="-1">CPU</FONT> impact on client and server.
We use known to be secure ciphers (e.g. no <FONT SIZE="-1">MD4</FONT>) and the <FONT SIZE="-1">TLS</FONT> protocol. This mode
also explicitly excludes non-PFS key exchange methods, such as <FONT SIZE="-1">RSA.</FONT>
<DT id="137"><B>--https-only</B><DD>
When in recursive mode, only <FONT SIZE="-1">HTTPS</FONT> links are followed.
<DT id="138"><B>--ciphers</B><DD>
Set the cipher list string. Typically this string sets the
cipher suites and other <FONT SIZE="-1">SSL/TLS</FONT> options that the user wish should be used, in a
set order of preference (GnuTLS calls it 'priority string'). This string
will be fed verbatim to the <FONT SIZE="-1">SSL/TLS</FONT> engine (OpenSSL or GnuTLS) and hence
its format and syntax is dependent on that. Wget will not process or manipulate it
in any way. Refer to the OpenSSL or GnuTLS documentation for more information.
<DT id="139"><B>--no-check-certificate</B><DD>
Don't check the server certificate against the available certificate
authorities. Also don't require the <FONT SIZE="-1">URL</FONT> host name to match the common
name presented by the certificate.
<P>
As of Wget 1.10, the default is to verify the server's certificate
against the recognized certificate authorities, breaking the <FONT SIZE="-1">SSL</FONT>
handshake and aborting the download if the verification fails.
Although this provides more secure downloads, it does break
interoperability with some sites that worked with previous Wget
versions, particularly those using self-signed, expired, or otherwise
invalid certificates. This option forces an ``insecure'' mode of
operation that turns the certificate verification errors into warnings
and allows you to proceed.
<P>
If you encounter ``certificate verification'' errors or ones saying
that ``common name doesn't match requested host name'', you can use
this option to bypass the verification and proceed with the download.
<I>Only use this option if you are otherwise convinced of the
site's authenticity, or if you really don't care about the validity of
its certificate.</I> It is almost always a bad idea not to check the
certificates when transmitting confidential or important data.
For self-signed/internal certificates, you should download the certificate
and verify against that instead of forcing this insecure mode.
If you are really sure of not desiring any certificate verification, you
can specify --check-certificate=quiet to tell wget to not print any
warning about invalid certificates, albeit in most cases this is the
wrong thing to do.
<DT id="140"><B>--certificate=</B><I>file</I><DD>
Use the client certificate stored in <I>file</I>. This is needed for
servers that are configured to require certificates from the clients
that connect to them. Normally a certificate is not required and this
switch is optional.
<DT id="141"><B>--certificate-type=</B><I>type</I><DD>
Specify the type of the client certificate. Legal values are
<B></B><FONT SIZE="-1"><B>PEM</B></FONT><B></B> (assumed by default) and <B></B><FONT SIZE="-1"><B>DER</B></FONT><B></B>, also known as
<B></B><FONT SIZE="-1"><B>ASN1</B></FONT><B></B>.
<DT id="142"><B>--private-key=</B><I>file</I><DD>
Read the private key from <I>file</I>. This allows you to provide the
private key in a file separate from the certificate.
<DT id="143"><B>--private-key-type=</B><I>type</I><DD>
Specify the type of the private key. Accepted values are <B></B><FONT SIZE="-1"><B>PEM</B></FONT><B></B>
(the default) and <B></B><FONT SIZE="-1"><B>DER</B></FONT><B></B>.
<DT id="144"><B>--ca-certificate=</B><I>file</I><DD>
Use <I>file</I> as the file with the bundle of certificate authorities
(``<FONT SIZE="-1">CA''</FONT>) to verify the peers. The certificates must be in <FONT SIZE="-1">PEM</FONT> format.
<P>
Without this option Wget looks for <FONT SIZE="-1">CA</FONT> certificates at the
system-specified locations, chosen at OpenSSL installation time.
<DT id="145"><B>--ca-directory=</B><I>directory</I><DD>
Specifies directory containing <FONT SIZE="-1">CA</FONT> certificates in <FONT SIZE="-1">PEM</FONT> format. Each
file contains one <FONT SIZE="-1">CA</FONT> certificate, and the file name is based on a hash
value derived from the certificate. This is achieved by processing a
certificate directory with the <TT>&quot;c_rehash&quot;</TT> utility supplied with
OpenSSL. Using <B>--ca-directory</B> is more efficient than
<B>--ca-certificate</B> when many certificates are installed because
it allows Wget to fetch certificates on demand.
<P>
Without this option Wget looks for <FONT SIZE="-1">CA</FONT> certificates at the
system-specified locations, chosen at OpenSSL installation time.
<DT id="146"><B>--crl-file=</B><I>file</I><DD>
Specifies a <FONT SIZE="-1">CRL</FONT> file in <I>file</I>. This is needed for certificates
that have been revocated by the CAs.
<DT id="147"><B>--pinnedpubkey=file/hashes</B><DD>
Tells wget to use the specified public key file (or hashes) to verify the peer.
This can be a path to a file which contains a single public key in <FONT SIZE="-1">PEM</FONT> or <FONT SIZE="-1">DER</FONT>
format, or any number of base64 encoded sha256 hashes preceded by ``sha256//''
and separated by ``;''
<P>
When negotiating a <FONT SIZE="-1">TLS</FONT> or <FONT SIZE="-1">SSL</FONT> connection, the server sends a certificate
indicating its identity. A public key is extracted from this certificate and if
it does not exactly match the public key(s) provided to this option, wget will
abort the connection before sending or receiving any data.
<DT id="148"><B>--random-file=</B><I>file</I><DD>
[OpenSSL and LibreSSL only]
Use <I>file</I> as the source of random data for seeding the
pseudo-random number generator on systems without <I>/dev/urandom</I>.
<P>
On such systems the <FONT SIZE="-1">SSL</FONT> library needs an external source of randomness
to initialize. Randomness may be provided by <FONT SIZE="-1">EGD</FONT> (see
<B>--egd-file</B> below) or read from an external source specified by
the user. If this option is not specified, Wget looks for random data
in <TT>$RANDFILE</TT> or, if that is unset, in <I></I>$HOME<I>/.rnd</I>.
<P>
If you're getting the ``Could not seed OpenSSL <FONT SIZE="-1">PRNG</FONT>; disabling <FONT SIZE="-1">SSL.''</FONT>
error, you should provide random data using some of the methods
described above.
<DT id="149"><B>--egd-file=</B><I>file</I><DD>
[OpenSSL only]
Use <I>file</I> as the <FONT SIZE="-1">EGD</FONT> socket. <FONT SIZE="-1">EGD</FONT> stands for <I>Entropy
Gathering Daemon</I>, a user-space program that collects data from
various unpredictable system sources and makes it available to other
programs that might need it. Encryption software, such as the <FONT SIZE="-1">SSL</FONT>
library, needs sources of non-repeating randomness to seed the random
number generator used to produce cryptographically strong keys.
<P>
OpenSSL allows the user to specify his own source of entropy using the
<TT>&quot;RAND_FILE&quot;</TT> environment variable. If this variable is unset, or
if the specified file does not produce enough randomness, OpenSSL will
read random data from <FONT SIZE="-1">EGD</FONT> socket specified using this option.
<P>
If this option is not specified (and the equivalent startup command is
not used), <FONT SIZE="-1">EGD</FONT> is never contacted. <FONT SIZE="-1">EGD</FONT> is not needed on modern Unix
systems that support <I>/dev/urandom</I>.
<DT id="150"><B>--no-hsts</B><DD>
Wget supports <FONT SIZE="-1">HSTS</FONT> (<FONT SIZE="-1">HTTP</FONT> Strict Transport Security, <FONT SIZE="-1">RFC 6797</FONT>) by default.
Use <B>--no-hsts</B> to make Wget act as a non-HSTS-compliant <FONT SIZE="-1">UA.</FONT> As a
consequence, Wget would ignore all the <TT>&quot;Strict-Transport-Security&quot;</TT>
headers, and would not enforce any existing <FONT SIZE="-1">HSTS</FONT> policy.
<DT id="151"><B>--hsts-file=</B><I>file</I><DD>
By default, Wget stores its <FONT SIZE="-1">HSTS</FONT> database in <I>~/.wget-hsts</I>.
You can use <B>--hsts-file</B> to override this. Wget will use
the supplied file as the <FONT SIZE="-1">HSTS</FONT> database. Such file must conform to the
correct <FONT SIZE="-1">HSTS</FONT> database format used by Wget. If Wget cannot parse the provided
file, the behaviour is unspecified.
<P>
The Wget's <FONT SIZE="-1">HSTS</FONT> database is a plain text file. Each line contains an <FONT SIZE="-1">HSTS</FONT> entry
(ie. a site that has issued a <TT>&quot;Strict-Transport-Security&quot;</TT> header and that
therefore has specified a concrete <FONT SIZE="-1">HSTS</FONT> policy to be applied). Lines starting with
a dash (<TT>&quot;#&quot;</TT>) are ignored by Wget. Please note that in spite of this convenient
human-readability hand-hacking the <FONT SIZE="-1">HSTS</FONT> database is generally not a good idea.
<P>
An <FONT SIZE="-1">HSTS</FONT> entry line consists of several fields separated by one or more whitespace:
<P>
<TT>&quot;&lt;hostname&gt; SP [&lt;port&gt;] SP &lt;include subdomains&gt; SP &lt;created&gt; SP &lt;max-age&gt;&quot;</TT>
<P>
The <I>hostname</I> and <I>port</I> fields indicate the hostname and port to which
the given <FONT SIZE="-1">HSTS</FONT> policy applies. The <I>port</I> field may be zero, and it will, in
most of the cases. That means that the port number will not be taken into account
when deciding whether such <FONT SIZE="-1">HSTS</FONT> policy should be applied on a given request (only
the hostname will be evaluated). When <I>port</I> is different to zero, both the
target hostname and the port will be evaluated and the <FONT SIZE="-1">HSTS</FONT> policy will only be applied
if both of them match. This feature has been included for testing/development purposes only.
The Wget testsuite (in <I>testenv/</I>) creates <FONT SIZE="-1">HSTS</FONT> databases with explicit ports
with the purpose of ensuring Wget's correct behaviour. Applying <FONT SIZE="-1">HSTS</FONT> policies to ports
other than the default ones is discouraged by <FONT SIZE="-1">RFC 6797</FONT> (see Appendix B ``Differences
between <FONT SIZE="-1">HSTS</FONT> Policy and Same-Origin Policy''). Thus, this functionality should not be used
in production environments and <I>port</I> will typically be zero. The last three fields
do what they are expected to. The field <I>include_subdomains</I> can either be <TT>1</TT>
or <TT>0</TT> and it signals whether the subdomains of the target domain should be
part of the given <FONT SIZE="-1">HSTS</FONT> policy as well. The <I>created</I> and <I>max-age</I> fields
hold the timestamp values of when such entry was created (first seen by Wget) and the
HSTS-defined value 'max-age', which states how long should that <FONT SIZE="-1">HSTS</FONT> policy remain active,
measured in seconds elapsed since the timestamp stored in <I>created</I>. Once that time
has passed, that <FONT SIZE="-1">HSTS</FONT> policy will no longer be valid and will eventually be removed
from the database.
<P>
If you supply your own <FONT SIZE="-1">HSTS</FONT> database via <B>--hsts-file</B>, be aware that Wget
may modify the provided file if any change occurs between the <FONT SIZE="-1">HSTS</FONT> policies
requested by the remote servers and those in the file. When Wget exists,
it effectively updates the <FONT SIZE="-1">HSTS</FONT> database by rewriting the database file with the new entries.
<P>
If the supplied file does not exist, Wget will create one. This file will contain the new <FONT SIZE="-1">HSTS</FONT>
entries. If no <FONT SIZE="-1">HSTS</FONT> entries were generated (no <TT>&quot;Strict-Transport-Security&quot;</TT> headers
were sent by any of the servers) then no file will be created, not even an empty one. This
behaviour applies to the default database file (<I>~/.wget-hsts</I>) as well: it will not be
created until some server enforces an <FONT SIZE="-1">HSTS</FONT> policy.
<P>
Care is taken not to override possible changes made by other Wget processes at
the same time over the <FONT SIZE="-1">HSTS</FONT> database. Before dumping the updated <FONT SIZE="-1">HSTS</FONT> entries
on the file, Wget will re-read it and merge the changes.
<P>
Using a custom <FONT SIZE="-1">HSTS</FONT> database and/or modifying an existing one is discouraged.
For more information about the potential security threats arose from such practice,
see section 14 ``Security Considerations'' of <FONT SIZE="-1">RFC 6797,</FONT> specially section 14.9
``Creative Manipulation of <FONT SIZE="-1">HSTS</FONT> Policy Store''.
<DT id="152"><B>--warc-file=</B><I>file</I><DD>
Use <I>file</I> as the destination <FONT SIZE="-1">WARC</FONT> file.
<DT id="153"><B>--warc-header=</B><I>string</I><DD>
Use <I>string</I> into as the warcinfo record.
<DT id="154"><B>--warc-max-size=</B><I>size</I><DD>
Set the maximum size of the <FONT SIZE="-1">WARC</FONT> files to <I>size</I>.
<DT id="155"><B>--warc-cdx</B><DD>
Write <FONT SIZE="-1">CDX</FONT> index files.
<DT id="156"><B>--warc-dedup=</B><I>file</I><DD>
Do not store records listed in this <FONT SIZE="-1">CDX</FONT> file.
<DT id="157"><B>--no-warc-compression</B><DD>
Do not compress <FONT SIZE="-1">WARC</FONT> files with <FONT SIZE="-1">GZIP.</FONT>
<DT id="158"><B>--no-warc-digests</B><DD>
Do not calculate <FONT SIZE="-1">SHA1</FONT> digests.
<DT id="159"><B>--no-warc-keep-log</B><DD>
Do not store the log file in a <FONT SIZE="-1">WARC</FONT> record.
<DT id="160"><B>--warc-tempdir=</B><I>dir</I><DD>
Specify the location for temporary files created by the <FONT SIZE="-1">WARC</FONT> writer.
</DL>
<A NAME="lbAM">&nbsp;</A>
<H3><FONT SIZE="-1">FTP</FONT> Options</H3>
<DL COMPACT>
<DT id="161"><B>--ftp-user=</B><I>user</I><DD>
<DT id="162"><B>--ftp-password=</B><I>password</I><DD>
Specify the username <I>user</I> and password <I>password</I> on an
<FONT SIZE="-1">FTP</FONT> server. Without this, or the corresponding startup option,
the password defaults to <B>-wget@</B>, normally used for anonymous
<FONT SIZE="-1">FTP.</FONT>
<P>
Another way to specify username and password is in the <FONT SIZE="-1">URL</FONT> itself. Either method reveals your password to anyone who
bothers to run <TT>&quot;ps&quot;</TT>. To prevent the passwords from being seen,
store them in <I>.wgetrc</I> or <I>.netrc</I>, and make sure to protect
those files from other users with <TT>&quot;chmod&quot;</TT>. If the passwords are
really important, do not leave them lying in those files either---edit
the files and delete them after Wget has started the download.
<DT id="163"><B>--no-remove-listing</B><DD>
Don't remove the temporary <I>.listing</I> files generated by <FONT SIZE="-1">FTP</FONT>
retrievals. Normally, these files contain the raw directory listings
received from <FONT SIZE="-1">FTP</FONT> servers. Not removing them can be useful for
debugging purposes, or when you want to be able to easily check on the
contents of remote server directories (e.g. to verify that a mirror
you're running is complete).
<P>
Note that even though Wget writes to a known filename for this file,
this is not a security hole in the scenario of a user making
<I>.listing</I> a symbolic link to <I>/etc/passwd</I> or something and
asking <TT>&quot;root&quot;</TT> to run Wget in his or her directory. Depending on
the options used, either Wget will refuse to write to <I>.listing</I>,
making the globbing/recursion/time-stamping operation fail, or the
symbolic link will be deleted and replaced with the actual
<I>.listing</I> file, or the listing will be written to a
<I>.listing.number</I> file.
<P>
Even though this situation isn't a problem, though, <TT>&quot;root&quot;</TT> should
never run Wget in a non-trusted user's directory. A user could do
something as simple as linking <I>index.html</I> to <I>/etc/passwd</I>
and asking <TT>&quot;root&quot;</TT> to run Wget with <B>-N</B> or <B>-r</B> so the file
will be overwritten.
<DT id="164"><B>--no-glob</B><DD>
Turn off <FONT SIZE="-1">FTP</FONT> globbing. Globbing refers to the use of shell-like
special characters (<I>wildcards</I>), like <B>*</B>, <B>?</B>, <B>[</B>
and <B>]</B> to retrieve more than one file from the same directory at
once, like:
<P>
<PRE>
wget <A HREF="ftp://gnjilux.srk.fer.hr/*.msg">ftp://gnjilux.srk.fer.hr/*.msg</A>
</PRE>
<P>
By default, globbing will be turned on if the <FONT SIZE="-1">URL</FONT> contains a
globbing character. This option may be used to turn globbing on or off
permanently.
<P>
You may have to quote the <FONT SIZE="-1">URL</FONT> to protect it from being expanded by
your shell. Globbing makes Wget look for a directory listing, which is
system-specific. This is why it currently works only with Unix <FONT SIZE="-1">FTP</FONT>
servers (and the ones emulating Unix <TT>&quot;ls&quot;</TT> output).
<DT id="165"><B>--no-passive-ftp</B><DD>
Disable the use of the <I>passive</I> <FONT SIZE="-1">FTP</FONT> transfer mode. Passive <FONT SIZE="-1">FTP</FONT>
mandates that the client connect to the server to establish the data
connection rather than the other way around.
<P>
If the machine is connected to the Internet directly, both passive and
active <FONT SIZE="-1">FTP</FONT> should work equally well. Behind most firewall and <FONT SIZE="-1">NAT</FONT>
configurations passive <FONT SIZE="-1">FTP</FONT> has a better chance of working. However,
in some rare firewall configurations, active <FONT SIZE="-1">FTP</FONT> actually works when
passive <FONT SIZE="-1">FTP</FONT> doesn't. If you suspect this to be the case, use this
option, or set <TT>&quot;passive_ftp=off&quot;</TT> in your init file.
<DT id="166"><B>--preserve-permissions</B><DD>
Preserve remote file permissions instead of permissions set by umask.
<DT id="167"><B>--retr-symlinks</B><DD>
By default, when retrieving <FONT SIZE="-1">FTP</FONT> directories recursively and a symbolic link
is encountered, the symbolic link is traversed and the pointed-to files are
retrieved. Currently, Wget does not traverse symbolic links to directories to
download them recursively, though this feature may be added in the future.
<P>
When <B>--retr-symlinks=no</B> is specified, the linked-to file is not
downloaded. Instead, a matching symbolic link is created on the local
filesystem. The pointed-to file will not be retrieved unless this recursive
retrieval would have encountered it separately and downloaded it anyway. This
option poses a security risk where a malicious <FONT SIZE="-1">FTP</FONT> Server may cause Wget to
write to files outside of the intended directories through a specially crafted
.LISTING file.
<P>
Note that when retrieving a file (not a directory) because it was
specified on the command-line, rather than because it was recursed to,
this option has no effect. Symbolic links are always traversed in this
case.
</DL>
<A NAME="lbAN">&nbsp;</A>
<H3><FONT SIZE="-1">FTPS</FONT> Options</H3>
<DL COMPACT>
<DT id="168"><B>--ftps-implicit</B><DD>
This option tells Wget to use <FONT SIZE="-1">FTPS</FONT> implicitly. Implicit <FONT SIZE="-1">FTPS</FONT> consists of initializing
<FONT SIZE="-1">SSL/TLS</FONT> from the very beginning of the control connection. This option does not send
an <TT>&quot;AUTH TLS&quot;</TT> command: it assumes the server speaks <FONT SIZE="-1">FTPS</FONT> and directly starts an
<FONT SIZE="-1">SSL/TLS</FONT> connection. If the attempt is successful, the session continues just like
regular <FONT SIZE="-1">FTPS</FONT> (<TT>&quot;PBSZ&quot;</TT> and <TT>&quot;PROT&quot;</TT> are sent, etc.).
Implicit <FONT SIZE="-1">FTPS</FONT> is no longer a requirement for <FONT SIZE="-1">FTPS</FONT> implementations, and thus
many servers may not support it. If <B>--ftps-implicit</B> is passed and no explicit
port number specified, the default port for implicit <FONT SIZE="-1">FTPS, 990,</FONT> will be used, instead
of the default port for the ``normal'' (explicit) <FONT SIZE="-1">FTPS</FONT> which is the same as that of <FONT SIZE="-1">FTP,
21.</FONT>
<DT id="169"><B>--no-ftps-resume-ssl</B><DD>
Do not resume the <FONT SIZE="-1">SSL/TLS</FONT> session in the data channel. When starting a data connection,
Wget tries to resume the <FONT SIZE="-1">SSL/TLS</FONT> session previously started in the control connection.
<FONT SIZE="-1">SSL/TLS</FONT> session resumption avoids performing an entirely new handshake by reusing
the <FONT SIZE="-1">SSL/TLS</FONT> parameters of a previous session. Typically, the <FONT SIZE="-1">FTPS</FONT> servers want it that way,
so Wget does this by default. Under rare circumstances however, one might want to
start an entirely new <FONT SIZE="-1">SSL/TLS</FONT> session in every data connection.
This is what <B>--no-ftps-resume-ssl</B> is for.
<DT id="170"><B>--ftps-clear-data-connection</B><DD>
All the data connections will be in plain text. Only the control connection will be
under <FONT SIZE="-1">SSL/TLS.</FONT> Wget will send a <TT>&quot;PROT C&quot;</TT> command to achieve this, which must be
approved by the server.
<DT id="171"><B>--ftps-fallback-to-ftp</B><DD>
Fall back to <FONT SIZE="-1">FTP</FONT> if <FONT SIZE="-1">FTPS</FONT> is not supported by the target server. For security reasons,
this option is not asserted by default. The default behaviour is to exit with an error.
If a server does not successfully reply to the initial <TT>&quot;AUTH TLS&quot;</TT> command, or in the
case of implicit <FONT SIZE="-1">FTPS,</FONT> if the initial <FONT SIZE="-1">SSL/TLS</FONT> connection attempt is rejected, it is
considered that such server does not support <FONT SIZE="-1">FTPS.</FONT>
</DL>
<A NAME="lbAO">&nbsp;</A>
<H3>Recursive Retrieval Options</H3>
<DL COMPACT>
<DT id="172"><B>-r</B><DD>
<DT id="173"><B>--recursive</B><DD>
Turn on recursive retrieving. The default maximum depth is 5.
<DT id="174"><B>-l</B> <I>depth</I><DD>
<DT id="175"><B>--level=</B><I>depth</I><DD>
Specify recursion maximum depth level <I>depth</I>.
<DT id="176"><B>--delete-after</B><DD>
This option tells Wget to delete every single file it downloads,
<I>after</I> having done so. It is useful for pre-fetching popular
pages through a proxy, e.g.:
<P>
<PRE>
wget -r -nd --delete-after <A HREF="http://whatever.com/~popular/page/">http://whatever.com/~popular/page/</A>
</PRE>
<P>
The <B>-r</B> option is to retrieve recursively, and <B>-nd</B> to not
create directories.
<P>
Note that <B>--delete-after</B> deletes files on the local machine. It
does not issue the <B></B><FONT SIZE="-1"><B>DELE</B></FONT><B></B> command to remote <FONT SIZE="-1">FTP</FONT> sites, for
instance. Also note that when <B>--delete-after</B> is specified,
<B>--convert-links</B> is ignored, so <B>.orig</B> files are simply not
created in the first place.
<DT id="177"><B>-k</B><DD>
<DT id="178"><B>--convert-links</B><DD>
After the download is complete, convert the links in the document to
make them suitable for local viewing. This affects not only the visible
hyperlinks, but any part of the document that links to external content,
such as embedded images, links to style sheets, hyperlinks to non-HTML
content, etc.
<P>
Each link will be changed in one of the two ways:
<DL COMPACT><DT id="179"><DD>
<DL COMPACT>
<DT id="180">&bull;<DD>
The links to files that have been downloaded by Wget will be changed to
refer to the file they point to as a relative link.
<P>
Example: if the downloaded file <I>/foo/doc.html</I> links to
<I>/bar/img.gif</I>, also downloaded, then the link in <I>doc.html</I>
will be modified to point to <B>../bar/img.gif</B>. This kind of
transformation works reliably for arbitrary combinations of directories.
<DT id="181">&bull;<DD>
The links to files that have not been downloaded by Wget will be changed
to include host name and absolute path of the location they point to.
<P>
Example: if the downloaded file <I>/foo/doc.html</I> links to
<I>/bar/img.gif</I> (or to <I>../bar/img.gif</I>), then the link in
<I>doc.html</I> will be modified to point to
<I><A HREF="http://hostname/bar/img.gif">http://hostname/bar/img.gif</A></I>.
</DL>
</DL>
<DL COMPACT><DT id="182"><DD>
<P>
Because of this, local browsing works reliably: if a linked file was
downloaded, the link will refer to its local name; if it was not
downloaded, the link will refer to its full Internet address rather than
presenting a broken link. The fact that the former links are converted
to relative links ensures that you can move the downloaded hierarchy to
another directory.
<P>
Note that only at the end of the download can Wget know which links have
been downloaded. Because of that, the work done by <B>-k</B> will be
performed at the end of all the downloads.
</DL>
<DT id="183"><B>--convert-file-only</B><DD>
This option converts only the filename part of the URLs, leaving the rest
of the URLs untouched. This filename part is sometimes referred to as the
``basename'', although we avoid that term here in order not to cause confusion.
<P>
It works particularly well in conjunction with <B>--adjust-extension</B>, although
this coupling is not enforced. It proves useful to populate Internet caches
with files downloaded from different hosts.
<P>
Example: if some link points to <I>//foo.com/bar.cgi?xyz</I> with
<B>--adjust-extension</B> asserted and its local destination is intended to be
<I>./foo.com/bar.cgi?xyz.css</I>, then the link would be converted to
<I>//foo.com/bar.cgi?xyz.css</I>. Note that only the filename part has been
modified. The rest of the <FONT SIZE="-1">URL</FONT> has been left untouched, including the net path
(<TT>&quot;//&quot;</TT>) which would otherwise be processed by Wget and converted to the
effective scheme (ie. <TT>&quot;http://&quot;</TT>).
<DT id="184"><B>-K</B><DD>
<DT id="185"><B>--backup-converted</B><DD>
When converting a file, back up the original version with a <B>.orig</B>
suffix. Affects the behavior of <B>-N</B>.
<DT id="186"><B>-m</B><DD>
<DT id="187"><B>--mirror</B><DD>
Turn on options suitable for mirroring. This option turns on recursion
and time-stamping, sets infinite recursion depth and keeps <FONT SIZE="-1">FTP</FONT>
directory listings. It is currently equivalent to
<B>-r -N -l inf --no-remove-listing</B>.
<DT id="188"><B>-p</B><DD>
<DT id="189"><B>--page-requisites</B><DD>
This option causes Wget to download all the files that are necessary to
properly display a given <FONT SIZE="-1">HTML</FONT> page. This includes such things as
inlined images, sounds, and referenced stylesheets.
<P>
Ordinarily, when downloading a single <FONT SIZE="-1">HTML</FONT> page, any requisite documents
that may be needed to display it properly are not downloaded. Using
<B>-r</B> together with <B>-l</B> can help, but since Wget does not
ordinarily distinguish between external and inlined documents, one is
generally left with ``leaf documents'' that are missing their
requisites.
<P>
For instance, say document <I>1.html</I> contains an <TT>&quot;&lt;IMG&gt;&quot;</TT> tag
referencing <I>1.gif</I> and an <TT>&quot;&lt;A&gt;&quot;</TT> tag pointing to external
document <I>2.html</I>. Say that <I>2.html</I> is similar but that its
image is <I>2.gif</I> and it links to <I>3.html</I>. Say this
continues up to some arbitrarily high number.
<P>
If one executes the command:
<P>
<PRE>
wget -r -l 2 http://&lt;site&gt;/1.html
</PRE>
<P>
then <I>1.html</I>, <I>1.gif</I>, <I>2.html</I>, <I>2.gif</I>, and
<I>3.html</I> will be downloaded. As you can see, <I>3.html</I> is
without its requisite <I>3.gif</I> because Wget is simply counting the
number of hops (up to 2) away from <I>1.html</I> in order to determine
where to stop the recursion. However, with this command:
<P>
<PRE>
wget -r -l 2 -p http://&lt;site&gt;/1.html
</PRE>
<P>
all the above files <I>and</I> <I>3.html</I>'s requisite <I>3.gif</I>
will be downloaded. Similarly,
<P>
<PRE>
wget -r -l 1 -p http://&lt;site&gt;/1.html
</PRE>
<P>
will cause <I>1.html</I>, <I>1.gif</I>, <I>2.html</I>, and <I>2.gif</I>
to be downloaded. One might think that:
<P>
<PRE>
wget -r -l 0 -p http://&lt;site&gt;/1.html
</PRE>
<P>
would download just <I>1.html</I> and <I>1.gif</I>, but unfortunately
this is not the case, because <B>-l 0</B> is equivalent to
<B>-l inf</B>---that is, infinite recursion. To download a single <FONT SIZE="-1">HTML</FONT>
page (or a handful of them, all specified on the command-line or in a
<B>-i</B> <FONT SIZE="-1">URL</FONT> input file) and its (or their) requisites, simply leave off
<B>-r</B> and <B>-l</B>:
<P>
<PRE>
wget -p http://&lt;site&gt;/1.html
</PRE>
<P>
Note that Wget will behave as if <B>-r</B> had been specified, but only
that single page and its requisites will be downloaded. Links from that
page to external documents will not be followed. Actually, to download
a single page and all its requisites (even if they exist on separate
websites), and make sure the lot displays properly locally, this author
likes to use a few options in addition to <B>-p</B>:
<P>
<PRE>
wget -E -H -k -K -p http://&lt;site&gt;/&lt;document&gt;
</PRE>
<P>
To finish off this topic, it's worth knowing that Wget's idea of an
external document link is any <FONT SIZE="-1">URL</FONT> specified in an <TT>&quot;&lt;A&gt;&quot;</TT> tag, an
<TT>&quot;&lt;AREA&gt;&quot;</TT> tag, or a <TT>&quot;&lt;LINK&gt;&quot;</TT> tag other than <TT>&quot;&lt;LINK
REL=&quot;stylesheet&quot;&gt;&quot;</TT>.
<DT id="190"><B>--strict-comments</B><DD>
Turn on strict parsing of <FONT SIZE="-1">HTML</FONT> comments. The default is to terminate
comments at the first occurrence of <B>--&gt;</B>.
<P>
According to specifications, <FONT SIZE="-1">HTML</FONT> comments are expressed as <FONT SIZE="-1">SGML</FONT>
<I>declarations</I>. Declaration is special markup that begins with
<B>&lt;!</B> and ends with <B>&gt;</B>, such as <B>&lt;!DOCTYPE ...&gt;</B>, that
may contain comments between a pair of <B>--</B> delimiters. <FONT SIZE="-1">HTML</FONT>
comments are ``empty declarations'', <FONT SIZE="-1">SGML</FONT> declarations without any
non-comment text. Therefore, <B>&lt;!--foo--&gt;</B> is a valid comment, and
so is <B>&lt;!--one--- --two--&gt;</B>, but <B>&lt;!--1--2--&gt;</B> is not.
<P>
On the other hand, most <FONT SIZE="-1">HTML</FONT> writers don't perceive comments as anything
other than text delimited with <B>&lt;!--</B> and <B>--&gt;</B>, which is not
quite the same. For example, something like <B>&lt;!------------&gt;</B>
works as a valid comment as long as the number of dashes is a multiple
of four (!). If not, the comment technically lasts until the next
<B>--</B>, which may be at the other end of the document. Because of
this, many popular browsers completely ignore the specification and
implement what users have come to expect: comments delimited with
<B>&lt;!--</B> and <B>--&gt;</B>.
<P>
Until version 1.9, Wget interpreted comments strictly, which resulted in
missing links in many web pages that displayed fine in browsers, but had
the misfortune of containing non-compliant comments. Beginning with
version 1.9, Wget has joined the ranks of clients that implements
``naive'' comments, terminating each comment at the first occurrence of
<B>--&gt;</B>.
<P>
If, for whatever reason, you want strict comment parsing, use this
option to turn it on.
</DL>
<A NAME="lbAP">&nbsp;</A>
<H3>Recursive Accept/Reject Options</H3>
<DL COMPACT>
<DT id="191"><B>-A</B> <I>acclist</I> <B>--accept</B> <I>acclist</I><DD>
<DT id="192"><B>-R</B> <I>rejlist</I> <B>--reject</B> <I>rejlist</I><DD>
Specify comma-separated lists of file name suffixes or patterns to
accept or reject. Note that if
any of the wildcard characters, <B>*</B>, <B>?</B>, <B>[</B> or
<B>]</B>, appear in an element of <I>acclist</I> or <I>rejlist</I>,
it will be treated as a pattern, rather than a suffix.
In this case, you have to enclose the pattern into quotes to prevent
your shell from expanding it, like in <B>-A ``*.mp3''</B> or <B>-A '*.mp3'</B>.
<DT id="193"><B>--accept-regex</B> <I>urlregex</I><DD>
<DT id="194"><B>--reject-regex</B> <I>urlregex</I><DD>
Specify a regular expression to accept or reject the complete <FONT SIZE="-1">URL.</FONT>
<DT id="195"><B>--regex-type</B> <I>regextype</I><DD>
Specify the regular expression type. Possible types are <B>posix</B> or
<B>pcre</B>. Note that to be able to use <B>pcre</B> type, wget has to be
compiled with libpcre support.
<DT id="196"><B>-D</B> <I>domain-list</I><DD>
<DT id="197"><B>--domains=</B><I>domain-list</I><DD>
Set domains to be followed. <I>domain-list</I> is a comma-separated list
of domains. Note that it does <I>not</I> turn on <B>-H</B>.
<DT id="198"><B>--exclude-domains</B> <I>domain-list</I><DD>
Specify the domains that are <I>not</I> to be followed.
<DT id="199"><B>--follow-ftp</B><DD>
Follow <FONT SIZE="-1">FTP</FONT> links from <FONT SIZE="-1">HTML</FONT> documents. Without this option,
Wget will ignore all the <FONT SIZE="-1">FTP</FONT> links.
<DT id="200"><B>--follow-tags=</B><I>list</I><DD>
Wget has an internal table of <FONT SIZE="-1">HTML</FONT> tag / attribute pairs that it
considers when looking for linked documents during a recursive
retrieval. If a user wants only a subset of those tags to be
considered, however, he or she should be specify such tags in a
comma-separated <I>list</I> with this option.
<DT id="201"><B>--ignore-tags=</B><I>list</I><DD>
This is the opposite of the <B>--follow-tags</B> option. To skip
certain <FONT SIZE="-1">HTML</FONT> tags when recursively looking for documents to download,
specify them in a comma-separated <I>list</I>.
<P>
In the past, this option was the best bet for downloading a single page
and its requisites, using a command-line like:
<P>
<PRE>
wget --ignore-tags=a,area -H -k -K -r http://&lt;site&gt;/&lt;document&gt;
</PRE>
<P>
However, the author of this option came across a page with tags like
<TT>&quot;&lt;LINK REL=&quot;home&quot; HREF=&quot;/&quot;&gt;&quot;</TT> and came to the realization that
specifying tags to ignore was not enough. One can't just tell Wget to
ignore <TT>&quot;&lt;LINK&gt;&quot;</TT>, because then stylesheets will not be downloaded.
Now the best bet for downloading a single page and its requisites is the
dedicated <B>--page-requisites</B> option.
<DT id="202"><B>--ignore-case</B><DD>
Ignore case when matching files and directories. This influences the
behavior of -R, -A, -I, and -X options, as well as globbing
implemented when downloading from <FONT SIZE="-1">FTP</FONT> sites. For example, with this
option, <B>-A ``*.txt''</B> will match <B>file1.txt</B>, but also
<B>file2.TXT</B>, <B>file3.TxT</B>, and so on.
The quotes in the example are to prevent the shell from expanding the
pattern.
<DT id="203"><B>-H</B><DD>
<DT id="204"><B>--span-hosts</B><DD>
Enable spanning across hosts when doing recursive retrieving.
<DT id="205"><B>-L</B><DD>
<DT id="206"><B>--relative</B><DD>
Follow relative links only. Useful for retrieving a specific home page
without any distractions, not even those from the same hosts.
<DT id="207"><B>-I</B> <I>list</I><DD>
<DT id="208"><B>--include-directories=</B><I>list</I><DD>
Specify a comma-separated list of directories you wish to follow when
downloading. Elements
of <I>list</I> may contain wildcards.
<DT id="209"><B>-X</B> <I>list</I><DD>
<DT id="210"><B>--exclude-directories=</B><I>list</I><DD>
Specify a comma-separated list of directories you wish to exclude from
download. Elements of
<I>list</I> may contain wildcards.
<DT id="211"><B>-np</B><DD>
<DT id="212"><B>--no-parent</B><DD>
Do not ever ascend to the parent directory when retrieving recursively.
This is a useful option, since it guarantees that only the files
<I>below</I> a certain hierarchy will be downloaded.
</DL>
<A NAME="lbAQ">&nbsp;</A>
<H2>ENVIRONMENT</H2>
Wget supports proxies for both <FONT SIZE="-1">HTTP</FONT> and <FONT SIZE="-1">FTP</FONT> retrievals. The
standard way to specify proxy location, which Wget recognizes, is using
the following environment variables:
<DL COMPACT>
<DT id="213"><B>http_proxy</B><DD>
<DT id="214"><B>https_proxy</B><DD>
If set, the <B>http_proxy</B> and <B>https_proxy</B> variables should
contain the URLs of the proxies for <FONT SIZE="-1">HTTP</FONT> and <FONT SIZE="-1">HTTPS</FONT>
connections respectively.
<DT id="215"><B>ftp_proxy</B><DD>
This variable should contain the <FONT SIZE="-1">URL</FONT> of the proxy for <FONT SIZE="-1">FTP</FONT>
connections. It is quite common that <B>http_proxy</B> and
<B>ftp_proxy</B> are set to the same <FONT SIZE="-1">URL.</FONT>
<DT id="216"><B>no_proxy</B><DD>
This variable should contain a comma-separated list of domain extensions
proxy should <I>not</I> be used for. For instance, if the value of
<B>no_proxy</B> is <B>.mit.edu</B>, proxy will not be used to retrieve
documents from <FONT SIZE="-1">MIT.</FONT>
</DL>
<A NAME="lbAR">&nbsp;</A>
<H2>EXIT STATUS</H2>
Wget may return one of several error codes if it encounters problems.
<DL COMPACT>
<DT id="217">0<DD>
No problems occurred.
<DT id="218">1<DD>
Generic error code.
<DT id="219">2<DD>
Parse error---for instance, when parsing command-line options, the
<B>.wgetrc</B> or <B>.netrc</B>...
<DT id="220">3<DD>
File I/O error.
<DT id="221">4<DD>
Network failure.
<DT id="222">5<DD>
<FONT SIZE="-1">SSL</FONT> verification failure.
<DT id="223">6<DD>
Username/password authentication failure.
<DT id="224">7<DD>
Protocol errors.
<DT id="225">8<DD>
Server issued an error response.
</DL>
<P>
With the exceptions of 0 and 1, the lower-numbered exit codes take
precedence over higher-numbered ones, when multiple types of errors
are encountered.
<P>
In versions of Wget prior to 1.12, Wget's exit status tended to be
unhelpful and inconsistent. Recursive downloads would virtually always
return 0 (success), regardless of any issues encountered, and
non-recursive fetches only returned the status corresponding to the
most recently-attempted download.
<A NAME="lbAS">&nbsp;</A>
<H2>FILES</H2>
<DL COMPACT>
<DT id="226"><B>/etc/wgetrc</B><DD>
Default location of the <I>global</I> startup file.
<DT id="227"><B>.wgetrc</B><DD>
User startup file.
</DL>
<A NAME="lbAT">&nbsp;</A>
<H2>BUGS</H2>
You are welcome to submit bug reports via the <FONT SIZE="-1">GNU</FONT> Wget bug tracker (see
&lt;<B><A HREF="https://savannah.gnu.org/bugs/?func=additem">https://savannah.gnu.org/bugs/?func=additem</A>&amp;group=wget</B>&gt;) or to our
mailing list &lt;<B><A HREF="mailto:bug-wget@gnu.org">bug-wget@gnu.org</A></B>&gt;.
<P>
Visit &lt;<B><A HREF="https://lists.gnu.org/mailman/listinfo/bug-wget">https://lists.gnu.org/mailman/listinfo/bug-wget</A></B>&gt; to
get more info (how to subscribe, list archives, ...).
<P>
Before actually submitting a bug report, please try to follow a few
simple guidelines.
<DL COMPACT>
<DT id="228">1.<DD>
Please try to ascertain that the behavior you see really is a bug. If
Wget crashes, it's a bug. If Wget does not behave as documented,
it's a bug. If things work strange, but you are not sure about the way
they are supposed to work, it might well be a bug, but you might want to
double-check the documentation and the mailing lists.
<DT id="229">2.<DD>
Try to repeat the bug in as simple circumstances as possible. E.g. if
Wget crashes while downloading <B>wget -rl0 -kKE -t5 --no-proxy
<A HREF="http://example.com">http://example.com</A> -o /tmp/log</B>, you should try to see if the crash is
repeatable, and if will occur with a simpler set of options. You might
even try to start the download at the page where the crash occurred to
see if that page somehow triggered the crash.
<P>
Also, while I will probably be interested to know the contents of your
<I>.wgetrc</I> file, just dumping it into the debug message is probably
a bad idea. Instead, you should first try to see if the bug repeats
with <I>.wgetrc</I> moved out of the way. Only if it turns out that
<I>.wgetrc</I> settings affect the bug, mail me the relevant parts of
the file.
<DT id="230">3.<DD>
Please start Wget with <B>-d</B> option and send us the resulting
output (or relevant parts thereof). If Wget was compiled without
debug support, recompile it---it is <I>much</I> easier to trace bugs
with debug support on.
<P>
Note: please make sure to remove any potentially sensitive information
from the debug log before sending it to the bug address. The
<TT>&quot;-d&quot;</TT> won't go out of its way to collect sensitive information,
but the log <I>will</I> contain a fairly complete transcript of Wget's
communication with the server, which may include passwords and pieces
of downloaded data. Since the bug address is publicly archived, you
may assume that all bug reports are visible to the public.
<DT id="231">4.<DD>
If Wget has crashed, try to run it in a debugger, e.g. <TT>&quot;gdb `which
wget` core&quot;</TT> and type <TT>&quot;where&quot;</TT> to get the backtrace. This may not
work if the system administrator has disabled core files, but it is
safe to try.
</DL>
<A NAME="lbAU">&nbsp;</A>
<H2>SEE ALSO</H2>
This is <B>not</B> the complete manual for <FONT SIZE="-1">GNU</FONT> Wget.
For more complete information, including more detailed explanations of
some of the options, and a number of commands available
for use with <I>.wgetrc</I> files and the <B>-e</B> option, see the <FONT SIZE="-1">GNU</FONT>
Info entry for <I>wget</I>.
<A NAME="lbAV">&nbsp;</A>
<H2>AUTHOR</H2>
Originally written by Hrvoje Nikšić &lt;<A HREF="mailto:hniksic@xemacs.org">hniksic@xemacs.org</A>&gt;.
<A NAME="lbAW">&nbsp;</A>
<H2>COPYRIGHT</H2>
Copyright (c) 1996-2011, 2015, 2018-2019 Free Software
Foundation, Inc.
<P>
Permission is granted to copy, distribute and/or modify this document
under the terms of the <FONT SIZE="-1">GNU</FONT> Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license is included in the section entitled
``<FONT SIZE="-1">GNU</FONT> Free Documentation License''.
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="232"><A HREF="#lbAB">NAME</A><DD>
<DT id="233"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="234"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="235"><A HREF="#lbAE">OPTIONS</A><DD>
<DL>
<DT id="236"><A HREF="#lbAF">Option Syntax</A><DD>
<DT id="237"><A HREF="#lbAG">Basic Startup Options</A><DD>
<DT id="238"><A HREF="#lbAH">Logging and Input File Options</A><DD>
<DT id="239"><A HREF="#lbAI">Download Options</A><DD>
<DT id="240"><A HREF="#lbAJ">Directory Options</A><DD>
<DT id="241"><A HREF="#lbAK"><FONT SIZE="-1">HTTP</FONT> Options</A><DD>
<DT id="242"><A HREF="#lbAL"><FONT SIZE="-1">HTTPS</FONT> (<FONT SIZE="-1">SSL/TLS</FONT>) Options</A><DD>
<DT id="243"><A HREF="#lbAM"><FONT SIZE="-1">FTP</FONT> Options</A><DD>
<DT id="244"><A HREF="#lbAN"><FONT SIZE="-1">FTPS</FONT> Options</A><DD>
<DT id="245"><A HREF="#lbAO">Recursive Retrieval Options</A><DD>
<DT id="246"><A HREF="#lbAP">Recursive Accept/Reject Options</A><DD>
</DL>
<DT id="247"><A HREF="#lbAQ">ENVIRONMENT</A><DD>
<DT id="248"><A HREF="#lbAR">EXIT STATUS</A><DD>
<DT id="249"><A HREF="#lbAS">FILES</A><DD>
<DT id="250"><A HREF="#lbAT">BUGS</A><DD>
<DT id="251"><A HREF="#lbAU">SEE ALSO</A><DD>
<DT id="252"><A HREF="#lbAV">AUTHOR</A><DD>
<DT id="253"><A HREF="#lbAW">COPYRIGHT</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:29 GMT, March 31, 2021
</BODY>
</HTML>