1
.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
4
.\" ========================================================================
5
.de Sh \" Subsection heading
13
.de Sp \" Vertical space (when we can't use .PP)
17
.de Vb \" Begin verbatim text
22
.de Ve \" End verbatim text
26
.\" Set up some character translations and predefined strings. \*(-- will
27
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
29
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
30
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
31
.\" nothing in troff, for use with C<>.
33
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
37
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
51
.\" If the F register is turned on, we'll generate index entries on stderr for
52
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53
.\" entries marked with X<> in POD. Of course, you'll have to process the
54
.\" output yourself in some meaningful fashion.
57
. tm Index:\\$1\t\\n%\t"\\$2"
63
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
64
.\" way too many mistakes in technical documents.
68
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69
.\" Fear. Run. Save yourself. No user-serviceable parts.
70
. \" fudge factors for nroff and troff
79
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
85
. \" simple accents for nroff and troff
95
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
102
. \" troff and (daisy-wheel) nroff accents
103
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110
.ds ae a\h'-(\w'a'u*4/10)'e
111
.ds Ae A\h'-(\w'A'u*4/10)'E
112
. \" corrections for vroff
113
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115
. \" for low resolution devices (crt and lpr)
116
.if \n(.H>23 .if \n(.V>19 \
129
.\" ========================================================================
132
.TH WGET 1 "2008-06-29" "GNU Wget 1.11.4" "GNU Wget"
134
Wget \- The non\-interactive network downloader.
136
.IX Header "SYNOPSIS"
137
wget [\fIoption\fR]... [\fI\s-1URL\s0\fR]...
139
.IX Header "DESCRIPTION"
140
\&\s-1GNU\s0 Wget is a free utility for non-interactive download of files from
141
the Web. It supports \s-1HTTP\s0, \s-1HTTPS\s0, and \s-1FTP\s0 protocols, as
142
well as retrieval through \s-1HTTP\s0 proxies.
144
Wget is non\-interactive, meaning that it can work in the background,
145
while the user is not logged on. This allows you to start a retrieval
146
and disconnect from the system, letting Wget finish the work. By
147
contrast, most of the Web browsers require constant user's presence,
148
which can be a great hindrance when transferring a lot of data.
150
Wget can follow links in \s-1HTML\s0 and \s-1XHTML\s0 pages and create local
151
versions of remote web sites, fully recreating the directory structure of
152
the original site. This is sometimes referred to as \*(L"recursive
153
downloading.\*(R" While doing that, Wget respects the Robot Exclusion
154
Standard (\fI/robots.txt\fR). Wget can be instructed to convert the
155
links in downloaded \s-1HTML\s0 files to the local files for offline
158
Wget has been designed for robustness over slow or unstable network
159
connections; if a download fails due to a network problem, it will
160
keep retrying until the whole file has been retrieved. If the server
161
supports regetting, it will instruct the server to continue the
162
download from where it left off.
166
.IX Subsection "Option Syntax"
167
Since Wget uses \s-1GNU\s0 getopt to process command-line arguments, every
168
option has a long form along with the short one. Long options are
169
more convenient to remember, but take time to type. You may freely
170
mix different option styles, or specify options after the command-line
171
arguments. Thus you may write:
174
\& wget \-r \-\-tries=10 http://fly.srk.fer.hr/ \-o log
177
The space between the option accepting an argument and the argument may
178
be omitted. Instead of \fB\-o log\fR you can write \fB\-olog\fR.
180
You may put several options that do not require arguments together,
187
This is a complete equivalent of:
190
\& wget \-d \-r \-c <URL>
193
Since the options can be specified after the arguments, you may
194
terminate them with \fB\-\-\fR. So the following will try to download
195
\&\s-1URL\s0 \fB\-x\fR, reporting failure to \fIlog\fR:
198
\& wget \-o log \-\- \-x
201
The options that accept comma-separated lists all respect the convention
202
that specifying an empty list clears its value. This can be useful to
203
clear the \fI.wgetrc\fR settings. For instance, if your \fI.wgetrc\fR
204
sets \f(CW\*(C`exclude_directories\*(C'\fR to \fI/cgi\-bin\fR, the following
205
example will first reset it, and then set it to exclude \fI/~nobody\fR
206
and \fI/~somebody\fR. You can also clear the lists in \fI.wgetrc\fR.
209
\& wget \-X " \-X /~nobody,/~somebody
212
Most options that do not accept arguments are \fIboolean\fR options,
213
so named because their state can be captured with a yes-or-no
214
(\*(L"boolean\*(R") variable. For example, \fB\-\-follow\-ftp\fR tells Wget
215
to follow \s-1FTP\s0 links from \s-1HTML\s0 files and, on the other hand,
216
\&\fB\-\-no\-glob\fR tells it not to perform file globbing on \s-1FTP\s0 URLs. A
217
boolean option is either \fIaffirmative\fR or \fInegative\fR
218
(beginning with \fB\-\-no\fR). All such options share several
221
Unless stated otherwise, it is assumed that the default behavior is
222
the opposite of what the option accomplishes. For example, the
223
documented existence of \fB\-\-follow\-ftp\fR assumes that the default
224
is to \fInot\fR follow \s-1FTP\s0 links from \s-1HTML\s0 pages.
226
Affirmative options can be negated by prepending the \fB\-\-no\-\fR to
227
the option name; negative options can be negated by omitting the
228
\&\fB\-\-no\-\fR prefix. This might seem superfluous\-\-\-if the default for
229
an affirmative option is to not do something, then why provide a way
230
to explicitly turn it off? But the startup file may in fact change
231
the default. For instance, using \f(CW\*(C`follow_ftp = off\*(C'\fR in
232
\&\fI.wgetrc\fR makes Wget \fInot\fR follow \s-1FTP\s0 links by default, and
233
using \fB\-\-no\-follow\-ftp\fR is the only way to restore the factory
234
default from the command line.
235
.Sh "Basic Startup Options"
236
.IX Subsection "Basic Startup Options"
240
.IP "\fB\-\-version\fR" 4
243
Display the version of Wget.
247
.IP "\fB\-\-help\fR" 4
250
Print a help message describing all of Wget's command-line options.
254
.IP "\fB\-\-background\fR" 4
255
.IX Item "--background"
257
Go to background immediately after startup. If no output file is
258
specified via the \fB\-o\fR, output is redirected to \fIwget-log\fR.
259
.IP "\fB\-e\fR \fIcommand\fR" 4
260
.IX Item "-e command"
262
.IP "\fB\-\-execute\fR \fIcommand\fR" 4
263
.IX Item "--execute command"
265
Execute \fIcommand\fR as if it were a part of \fI.wgetrc\fR. A command thus invoked will be executed
266
\&\fIafter\fR the commands in \fI.wgetrc\fR, thus taking precedence over
267
them. If you need to specify more than one wgetrc command, use multiple
268
instances of \fB\-e\fR.
269
.Sh "Logging and Input File Options"
270
.IX Subsection "Logging and Input File Options"
271
.IP "\fB\-o\fR \fIlogfile\fR" 4
272
.IX Item "-o logfile"
274
.IP "\fB\-\-output\-file=\fR\fIlogfile\fR" 4
275
.IX Item "--output-file=logfile"
277
Log all messages to \fIlogfile\fR. The messages are normally reported
279
.IP "\fB\-a\fR \fIlogfile\fR" 4
280
.IX Item "-a logfile"
282
.IP "\fB\-\-append\-output=\fR\fIlogfile\fR" 4
283
.IX Item "--append-output=logfile"
285
Append to \fIlogfile\fR. This is the same as \fB\-o\fR, only it appends
286
to \fIlogfile\fR instead of overwriting the old log file. If
287
\&\fIlogfile\fR does not exist, a new file is created.
291
.IP "\fB\-\-debug\fR" 4
294
Turn on debug output, meaning various information important to the
295
developers of Wget if it does not work properly. Your system
296
administrator may have chosen to compile Wget without debug support, in
297
which case \fB\-d\fR will not work. Please note that compiling with
298
debug support is always safe\-\-\-Wget compiled with the debug support will
299
\&\fInot\fR print any debug info unless requested with \fB\-d\fR.
303
.IP "\fB\-\-quiet\fR" 4
306
Turn off Wget's output.
310
.IP "\fB\-\-verbose\fR" 4
313
Turn on verbose output, with all the available data. The default output
318
.IP "\fB\-\-no\-verbose\fR" 4
319
.IX Item "--no-verbose"
321
Turn off verbose without being completely quiet (use \fB\-q\fR for
322
that), which means that error messages and basic information still get
324
.IP "\fB\-i\fR \fIfile\fR" 4
327
.IP "\fB\-\-input\-file=\fR\fIfile\fR" 4
328
.IX Item "--input-file=file"
330
Read URLs from \fIfile\fR. If \fB\-\fR is specified as
331
\&\fIfile\fR, URLs are read from the standard input. (Use
332
\&\fB./\-\fR to read from a file literally named \fB\-\fR.)
334
If this function is used, no URLs need be present on the command
335
line. If there are URLs both on the command line and in an input
336
file, those on the command lines will be the first ones to be
337
retrieved. The \fIfile\fR need not be an \s-1HTML\s0 document (but no
338
harm if it is)\-\-\-it is enough if the URLs are just listed
341
However, if you specify \fB\-\-force\-html\fR, the document will be
342
regarded as \fBhtml\fR. In that case you may have problems with
343
relative links, which you can solve either by adding \f(CW\*(C`<base
344
href="\f(CIurl\f(CW">\*(C'\fR to the documents or by specifying
345
\&\fB\-\-base=\fR\fIurl\fR on the command line.
349
.IP "\fB\-\-force\-html\fR" 4
350
.IX Item "--force-html"
352
When input is read from a file, force it to be treated as an \s-1HTML\s0
353
file. This enables you to retrieve relative links from existing
354
\&\s-1HTML\s0 files on your local disk, by adding \f(CW\*(C`<base
355
href="\f(CIurl\f(CW">\*(C'\fR to \s-1HTML\s0, or using the \fB\-\-base\fR command-line
357
.IP "\fB\-B\fR \fI\s-1URL\s0\fR" 4
360
.IP "\fB\-\-base=\fR\fI\s-1URL\s0\fR" 4
361
.IX Item "--base=URL"
363
Prepends \fI\s-1URL\s0\fR to relative links read from the file specified with
364
the \fB\-i\fR option.
365
.Sh "Download Options"
366
.IX Subsection "Download Options"
367
.IP "\fB\-\-bind\-address=\fR\fI\s-1ADDRESS\s0\fR" 4
368
.IX Item "--bind-address=ADDRESS"
369
When making client \s-1TCP/IP\s0 connections, bind to \fI\s-1ADDRESS\s0\fR on
370
the local machine. \fI\s-1ADDRESS\s0\fR may be specified as a hostname or \s-1IP\s0
371
address. This option can be useful if your machine is bound to multiple
373
.IP "\fB\-t\fR \fInumber\fR" 4
376
.IP "\fB\-\-tries=\fR\fInumber\fR" 4
377
.IX Item "--tries=number"
379
Set number of retries to \fInumber\fR. Specify 0 or \fBinf\fR for
380
infinite retrying. The default is to retry 20 times, with the exception
381
of fatal errors like \*(L"connection refused\*(R" or \*(L"not found\*(R" (404),
382
which are not retried.
383
.IP "\fB\-O\fR \fIfile\fR" 4
386
.IP "\fB\-\-output\-document=\fR\fIfile\fR" 4
387
.IX Item "--output-document=file"
389
The documents will not be written to the appropriate files, but all
390
will be concatenated together and written to \fIfile\fR. If \fB\-\fR
391
is used as \fIfile\fR, documents will be printed to standard output,
392
disabling link conversion. (Use \fB./\-\fR to print to a file
393
literally named \fB\-\fR.)
395
Use of \fB\-O\fR is \fInot\fR intended to mean simply "use the name
396
\&\fIfile\fR instead of the one in the \s-1URL\s0;" rather, it is
397
analogous to shell redirection:
398
\&\fBwget \-O file http://foo\fR is intended to work like
399
\&\fBwget \-O \- http://foo > file\fR; \fIfile\fR will be truncated
400
immediately, and \fIall\fR downloaded content will be written there.
402
For this reason, \fB\-N\fR (for timestamp\-checking) is not supported
403
in combination with \fB\-O\fR: since \fIfile\fR is always newly
404
created, it will always have a very new timestamp. A warning will be
405
issued if this combination is used.
407
Similarly, using \fB\-r\fR or \fB\-p\fR with \fB\-O\fR may not work as
408
you expect: Wget won't just download the first file to \fIfile\fR and
409
then download the rest to their normal names: \fIall\fR downloaded
410
content will be placed in \fIfile\fR. This was disabled in version
411
1.11, but has been reinstated (with a warning) in 1.11.2, as there are
412
some cases where this behavior can actually have some use.
414
Note that a combination with \fB\-k\fR is only permitted when
415
downloading a single document, as in that case it will just convert
416
all relative URIs to external ones; \fB\-k\fR makes no sense for
417
multiple URIs when they're all being downloaded to a single file.
421
.IP "\fB\-\-no\-clobber\fR" 4
422
.IX Item "--no-clobber"
424
If a file is downloaded more than once in the same directory, Wget's
425
behavior depends on a few options, including \fB\-nc\fR. In certain
426
cases, the local file will be \fIclobbered\fR, or overwritten, upon
427
repeated download. In other cases it will be preserved.
429
When running Wget without \fB\-N\fR, \fB\-nc\fR, \fB\-r\fR, or \fBp\fR,
430
downloading the same file in the same directory will result in the
431
original copy of \fIfile\fR being preserved and the second copy being
432
named \fIfile\fR\fB.1\fR. If that file is downloaded yet again, the
433
third copy will be named \fIfile\fR\fB.2\fR, and so on. When
434
\&\fB\-nc\fR is specified, this behavior is suppressed, and Wget will
435
refuse to download newer copies of \fIfile\fR. Therefore,
436
"\f(CW\*(C`no\-clobber\*(C'\fR" is actually a misnomer in this mode\-\-\-it's not
437
clobbering that's prevented (as the numeric suffixes were already
438
preventing clobbering), but rather the multiple version saving that's
441
When running Wget with \fB\-r\fR or \fB\-p\fR, but without \fB\-N\fR
442
or \fB\-nc\fR, re-downloading a file will result in the new copy
443
simply overwriting the old. Adding \fB\-nc\fR will prevent this
444
behavior, instead causing the original version to be preserved and any
445
newer copies on the server to be ignored.
447
When running Wget with \fB\-N\fR, with or without \fB\-r\fR or
448
\&\fB\-p\fR, the decision as to whether or not to download a newer copy
449
of a file depends on the local and remote timestamp and size of the
450
file. \fB\-nc\fR may not be specified at the
451
same time as \fB\-N\fR.
453
Note that when \fB\-nc\fR is specified, files with the suffixes
454
\&\fB.html\fR or \fB.htm\fR will be loaded from the local disk and
455
parsed as if they had been retrieved from the Web.
459
.IP "\fB\-\-continue\fR" 4
460
.IX Item "--continue"
462
Continue getting a partially-downloaded file. This is useful when you
463
want to finish up a download started by a previous instance of Wget, or
464
by another program. For instance:
467
\& wget \-c ftp://sunsite.doc.ic.ac.uk/ls\-lR.Z
470
If there is a file named \fIls\-lR.Z\fR in the current directory, Wget
471
will assume that it is the first portion of the remote file, and will
472
ask the server to continue the retrieval from an offset equal to the
473
length of the local file.
475
Note that you don't need to specify this option if you just want the
476
current invocation of Wget to retry downloading a file should the
477
connection be lost midway through. This is the default behavior.
478
\&\fB\-c\fR only affects resumption of downloads started \fIprior\fR to
479
this invocation of Wget, and whose local files are still sitting around.
481
Without \fB\-c\fR, the previous example would just download the remote
482
file to \fIls\-lR.Z.1\fR, leaving the truncated \fIls\-lR.Z\fR file
485
Beginning with Wget 1.7, if you use \fB\-c\fR on a non-empty file, and
486
it turns out that the server does not support continued downloading,
487
Wget will refuse to start the download from scratch, which would
488
effectively ruin existing contents. If you really want the download to
489
start from scratch, remove the file.
491
Also beginning with Wget 1.7, if you use \fB\-c\fR on a file which is of
492
equal size as the one on the server, Wget will refuse to download the
493
file and print an explanatory message. The same happens when the file
494
is smaller on the server than locally (presumably because it was changed
495
on the server since your last download attempt)\-\-\-because \*(L"continuing\*(R"
496
is not meaningful, no download occurs.
498
On the other side of the coin, while using \fB\-c\fR, any file that's
499
bigger on the server than locally will be considered an incomplete
500
download and only \f(CW\*(C`(length(remote) \- length(local))\*(C'\fR bytes will be
501
downloaded and tacked onto the end of the local file. This behavior can
502
be desirable in certain cases\-\-\-for instance, you can use \fBwget \-c\fR
503
to download just the new portion that's been appended to a data
504
collection or log file.
506
However, if the file is bigger on the server because it's been
507
\&\fIchanged\fR, as opposed to just \fIappended\fR to, you'll end up
508
with a garbled file. Wget has no way of verifying that the local file
509
is really a valid prefix of the remote file. You need to be especially
510
careful of this when using \fB\-c\fR in conjunction with \fB\-r\fR,
511
since every file will be considered as an \*(L"incomplete download\*(R" candidate.
513
Another instance where you'll get a garbled file if you try to use
514
\&\fB\-c\fR is if you have a lame \s-1HTTP\s0 proxy that inserts a
515
\&\*(L"transfer interrupted\*(R" string into the local file. In the future a
516
\&\*(L"rollback\*(R" option may be added to deal with this case.
518
Note that \fB\-c\fR only works with \s-1FTP\s0 servers and with \s-1HTTP\s0
519
servers that support the \f(CW\*(C`Range\*(C'\fR header.
520
.IP "\fB\-\-progress=\fR\fItype\fR" 4
521
.IX Item "--progress=type"
522
Select the type of the progress indicator you wish to use. Legal
523
indicators are \*(L"dot\*(R" and \*(L"bar\*(R".
525
The \*(L"bar\*(R" indicator is used by default. It draws an \s-1ASCII\s0 progress
526
bar graphics (a.k.a \*(L"thermometer\*(R" display) indicating the status of
527
retrieval. If the output is not a \s-1TTY\s0, the \*(L"dot\*(R" bar will be used by
530
Use \fB\-\-progress=dot\fR to switch to the \*(L"dot\*(R" display. It traces
531
the retrieval by printing dots on the screen, each dot representing a
532
fixed amount of downloaded data.
534
When using the dotted retrieval, you may also set the \fIstyle\fR by
535
specifying the type as \fBdot:\fR\fIstyle\fR. Different styles assign
536
different meaning to one dot. With the \f(CW\*(C`default\*(C'\fR style each dot
537
represents 1K, there are ten dots in a cluster and 50 dots in a line.
538
The \f(CW\*(C`binary\*(C'\fR style has a more \*(L"computer\*(R"\-like orientation\-\-\-8K
539
dots, 16\-dots clusters and 48 dots per line (which makes for 384K
540
lines). The \f(CW\*(C`mega\*(C'\fR style is suitable for downloading very large
541
files\-\-\-each dot represents 64K retrieved, there are eight dots in a
542
cluster, and 48 dots on each line (so each line contains 3M).
544
Note that you can set the default style using the \f(CW\*(C`progress\*(C'\fR
545
command in \fI.wgetrc\fR. That setting may be overridden from the
546
command line. The exception is that, when the output is not a \s-1TTY\s0, the
547
\&\*(L"dot\*(R" progress will be favored over \*(L"bar\*(R". To force the bar output,
548
use \fB\-\-progress=bar:force\fR.
552
.IP "\fB\-\-timestamping\fR" 4
553
.IX Item "--timestamping"
555
Turn on time\-stamping.
559
.IP "\fB\-\-server\-response\fR" 4
560
.IX Item "--server-response"
562
Print the headers sent by \s-1HTTP\s0 servers and responses sent by
563
\&\s-1FTP\s0 servers.
564
.IP "\fB\-\-spider\fR" 4
566
When invoked with this option, Wget will behave as a Web \fIspider\fR,
567
which means that it will not download the pages, just check that they
568
are there. For example, you can use Wget to check your bookmarks:
571
\& wget \-\-spider \-\-force\-html \-i bookmarks.html
574
This feature needs much more work for Wget to get close to the
575
functionality of real web spiders.
576
.IP "\fB\-T seconds\fR" 4
577
.IX Item "-T seconds"
579
.IP "\fB\-\-timeout=\fR\fIseconds\fR" 4
580
.IX Item "--timeout=seconds"
582
Set the network timeout to \fIseconds\fR seconds. This is equivalent
583
to specifying \fB\-\-dns\-timeout\fR, \fB\-\-connect\-timeout\fR, and
584
\&\fB\-\-read\-timeout\fR, all at the same time.
586
When interacting with the network, Wget can check for timeout and
587
abort the operation if it takes too long. This prevents anomalies
588
like hanging reads and infinite connects. The only timeout enabled by
589
default is a 900\-second read timeout. Setting a timeout to 0 disables
590
it altogether. Unless you know what you are doing, it is best not to
591
change the default timeout settings.
593
All timeout-related options accept decimal values, as well as
594
subsecond values. For example, \fB0.1\fR seconds is a legal (though
595
unwise) choice of timeout. Subsecond timeouts are useful for checking
596
server response times or for testing network latency.
597
.IP "\fB\-\-dns\-timeout=\fR\fIseconds\fR" 4
598
.IX Item "--dns-timeout=seconds"
599
Set the \s-1DNS\s0 lookup timeout to \fIseconds\fR seconds. \s-1DNS\s0 lookups that
600
don't complete within the specified time will fail. By default, there
601
is no timeout on \s-1DNS\s0 lookups, other than that implemented by system
603
.IP "\fB\-\-connect\-timeout=\fR\fIseconds\fR" 4
604
.IX Item "--connect-timeout=seconds"
605
Set the connect timeout to \fIseconds\fR seconds. \s-1TCP\s0 connections that
606
take longer to establish will be aborted. By default, there is no
607
connect timeout, other than that implemented by system libraries.
608
.IP "\fB\-\-read\-timeout=\fR\fIseconds\fR" 4
609
.IX Item "--read-timeout=seconds"
610
Set the read (and write) timeout to \fIseconds\fR seconds. The
611
\&\*(L"time\*(R" of this timeout refers to \fIidle time\fR: if, at any point in
612
the download, no data is received for more than the specified number
613
of seconds, reading fails and the download is restarted. This option
614
does not directly affect the duration of the entire download.
616
Of course, the remote server may choose to terminate the connection
617
sooner than this option requires. The default read timeout is 900
619
.IP "\fB\-\-limit\-rate=\fR\fIamount\fR" 4
620
.IX Item "--limit-rate=amount"
621
Limit the download speed to \fIamount\fR bytes per second. Amount may
622
be expressed in bytes, kilobytes with the \fBk\fR suffix, or megabytes
623
with the \fBm\fR suffix. For example, \fB\-\-limit\-rate=20k\fR will
624
limit the retrieval rate to 20KB/s. This is useful when, for whatever
625
reason, you don't want Wget to consume the entire available bandwidth.
627
This option allows the use of decimal numbers, usually in conjunction
628
with power suffixes; for example, \fB\-\-limit\-rate=2.5k\fR is a legal
631
Note that Wget implements the limiting by sleeping the appropriate
632
amount of time after a network read that took less time than specified
633
by the rate. Eventually this strategy causes the \s-1TCP\s0 transfer to slow
634
down to approximately the specified rate. However, it may take some
635
time for this balance to be achieved, so don't be surprised if limiting
636
the rate doesn't work well with very small files.
637
.IP "\fB\-w\fR \fIseconds\fR" 4
638
.IX Item "-w seconds"
640
.IP "\fB\-\-wait=\fR\fIseconds\fR" 4
641
.IX Item "--wait=seconds"
643
Wait the specified number of seconds between the retrievals. Use of
644
this option is recommended, as it lightens the server load by making the
645
requests less frequent. Instead of in seconds, the time can be
646
specified in minutes using the \f(CW\*(C`m\*(C'\fR suffix, in hours using \f(CW\*(C`h\*(C'\fR
647
suffix, or in days using \f(CW\*(C`d\*(C'\fR suffix.
649
Specifying a large value for this option is useful if the network or the
650
destination host is down, so that Wget can wait long enough to
651
reasonably expect the network error to be fixed before the retry. The
652
waiting interval specified by this function is influenced by
653
\&\f(CW\*(C`\-\-random\-wait\*(C'\fR, which see.
654
.IP "\fB\-\-waitretry=\fR\fIseconds\fR" 4
655
.IX Item "--waitretry=seconds"
656
If you don't want Wget to wait between \fIevery\fR retrieval, but only
657
between retries of failed downloads, you can use this option. Wget will
658
use \fIlinear backoff\fR, waiting 1 second after the first failure on a
659
given file, then waiting 2 seconds after the second failure on that
660
file, up to the maximum number of \fIseconds\fR you specify. Therefore,
661
a value of 10 will actually make Wget wait up to (1 + 2 + ... + 10) = 55
664
Note that this option is turned on by default in the global
666
.IP "\fB\-\-random\-wait\fR" 4
667
.IX Item "--random-wait"
668
Some web sites may perform log analysis to identify retrieval programs
669
such as Wget by looking for statistically significant similarities in
670
the time between requests. This option causes the time between requests
671
to vary between 0.5 and 1.5 * \fIwait\fR seconds, where \fIwait\fR was
672
specified using the \fB\-\-wait\fR option, in order to mask Wget's
673
presence from such analysis.
675
A 2001 article in a publication devoted to development on a popular
676
consumer platform provided code to perform this analysis on the fly.
677
Its author suggested blocking at the class C address level to ensure
678
automated retrieval programs were blocked despite changing DHCP-supplied
681
The \fB\-\-random\-wait\fR option was inspired by this ill-advised
682
recommendation to block many unrelated users from a web site due to the
684
.IP "\fB\-\-no\-proxy\fR" 4
685
.IX Item "--no-proxy"
686
Don't use proxies, even if the appropriate \f(CW*_proxy\fR environment
688
.IP "\fB\-Q\fR \fIquota\fR" 4
691
.IP "\fB\-\-quota=\fR\fIquota\fR" 4
692
.IX Item "--quota=quota"
694
Specify download quota for automatic retrievals. The value can be
695
specified in bytes (default), kilobytes (with \fBk\fR suffix), or
696
megabytes (with \fBm\fR suffix).
698
Note that quota will never affect downloading a single file. So if you
699
specify \fBwget \-Q10k ftp://wuarchive.wustl.edu/ls\-lR.gz\fR, all of the
700
\&\fIls\-lR.gz\fR will be downloaded. The same goes even when several
701
URLs are specified on the command\-line. However, quota is
702
respected when retrieving either recursively, or from an input file.
703
Thus you may safely type \fBwget \-Q2m \-i sites\fR\-\-\-download will be
704
aborted when the quota is exceeded.
706
Setting quota to 0 or to \fBinf\fR unlimits the download quota.
707
.IP "\fB\-\-no\-dns\-cache\fR" 4
708
.IX Item "--no-dns-cache"
709
Turn off caching of \s-1DNS\s0 lookups. Normally, Wget remembers the \s-1IP\s0
710
addresses it looked up from \s-1DNS\s0 so it doesn't have to repeatedly
711
contact the \s-1DNS\s0 server for the same (typically small) set of hosts it
712
retrieves from. This cache exists in memory only; a new Wget run will
713
contact \s-1DNS\s0 again.
715
However, it has been reported that in some situations it is not
716
desirable to cache host names, even for the duration of a
717
short-running application like Wget. With this option Wget issues a
718
new \s-1DNS\s0 lookup (more precisely, a new call to \f(CW\*(C`gethostbyname\*(C'\fR or
719
\&\f(CW\*(C`getaddrinfo\*(C'\fR) each time it makes a new connection. Please note
720
that this option will \fInot\fR affect caching that might be
721
performed by the resolving library or by an external caching layer,
724
If you don't understand exactly what this option does, you probably
726
.IP "\fB\-\-restrict\-file\-names=\fR\fImode\fR" 4
727
.IX Item "--restrict-file-names=mode"
728
Change which characters found in remote URLs may show up in local file
729
names generated from those URLs. Characters that are \fIrestricted\fR
730
by this option are escaped, i.e. replaced with \fB%HH\fR, where
731
\&\fB\s-1HH\s0\fR is the hexadecimal number that corresponds to the restricted
734
By default, Wget escapes the characters that are not valid as part of
735
file names on your operating system, as well as control characters that
736
are typically unprintable. This option is useful for changing these
737
defaults, either because you are downloading to a non-native partition,
738
or because you want to disable escaping of the control characters.
740
When mode is set to \*(L"unix\*(R", Wget escapes the character \fB/\fR and
741
the control characters in the ranges 0\-\-31 and 128\-\-159. This is the
742
default on Unix-like \s-1OS\s0'es.
744
When mode is set to \*(L"windows\*(R", Wget escapes the characters \fB\e\fR,
745
\&\fB|\fR, \fB/\fR, \fB:\fR, \fB?\fR, \fB"\fR, \fB*\fR, \fB<\fR,
746
\&\fB>\fR, and the control characters in the ranges 0\-\-31 and 128\-\-159.
747
In addition to this, Wget in Windows mode uses \fB+\fR instead of
748
\&\fB:\fR to separate host and port in local file names, and uses
749
\&\fB@\fR instead of \fB?\fR to separate the query portion of the file
750
name from the rest. Therefore, a \s-1URL\s0 that would be saved as
751
\&\fBwww.xemacs.org:4300/search.pl?input=blah\fR in Unix mode would be
752
saved as \fBwww.xemacs.org+4300/search.pl@input=blah\fR in Windows
753
mode. This mode is the default on Windows.
755
If you append \fB,nocontrol\fR to the mode, as in
756
\&\fBunix,nocontrol\fR, escaping of the control characters is also
757
switched off. You can use \fB\-\-restrict\-file\-names=nocontrol\fR to
758
turn off escaping of control characters without affecting the choice of
759
the \s-1OS\s0 to use as file name restriction mode.
763
.IP "\fB\-\-inet4\-only\fR" 4
764
.IX Item "--inet4-only"
767
.IP "\fB\-\-inet6\-only\fR" 4
768
.IX Item "--inet6-only"
770
Force connecting to IPv4 or IPv6 addresses. With \fB\-\-inet4\-only\fR
771
or \fB\-4\fR, Wget will only connect to IPv4 hosts, ignoring \s-1AAAA\s0
772
records in \s-1DNS\s0, and refusing to connect to IPv6 addresses specified in
773
URLs. Conversely, with \fB\-\-inet6\-only\fR or \fB\-6\fR, Wget will
774
only connect to IPv6 hosts and ignore A records and IPv4 addresses.
776
Neither options should be needed normally. By default, an IPv6\-aware
777
Wget will use the address family specified by the host's \s-1DNS\s0 record.
778
If the \s-1DNS\s0 responds with both IPv4 and IPv6 addresses, Wget will try
779
them in sequence until it finds one it can connect to. (Also see
780
\&\f(CW\*(C`\-\-prefer\-family\*(C'\fR option described below.)
782
These options can be used to deliberately force the use of IPv4 or
783
IPv6 address families on dual family systems, usually to aid debugging
784
or to deal with broken network configuration. Only one of
785
\&\fB\-\-inet6\-only\fR and \fB\-\-inet4\-only\fR may be specified at the
786
same time. Neither option is available in Wget compiled without IPv6
788
.IP "\fB\-\-prefer\-family=IPv4/IPv6/none\fR" 4
789
.IX Item "--prefer-family=IPv4/IPv6/none"
790
When given a choice of several addresses, connect to the addresses
791
with specified address family first. IPv4 addresses are preferred by
794
This avoids spurious errors and connect attempts when accessing hosts
795
that resolve to both IPv6 and IPv4 addresses from IPv4 networks. For
796
example, \fBwww.kame.net\fR resolves to
797
\&\fB2001:200:0:8002:203:47ff:fea5:3085\fR and to
798
\&\fB203.178.141.194\fR. When the preferred family is \f(CW\*(C`IPv4\*(C'\fR, the
799
IPv4 address is used first; when the preferred family is \f(CW\*(C`IPv6\*(C'\fR,
800
the IPv6 address is used first; if the specified value is \f(CW\*(C`none\*(C'\fR,
801
the address order returned by \s-1DNS\s0 is used without change.
803
Unlike \fB\-4\fR and \fB\-6\fR, this option doesn't inhibit access to
804
any address family, it only changes the \fIorder\fR in which the
805
addresses are accessed. Also note that the reordering performed by
806
this option is \fIstable\fR\-\-\-it doesn't affect order of addresses of
807
the same family. That is, the relative order of all IPv4 addresses
808
and of all IPv6 addresses remains intact in all cases.
809
.IP "\fB\-\-retry\-connrefused\fR" 4
810
.IX Item "--retry-connrefused"
811
Consider \*(L"connection refused\*(R" a transient error and try again.
812
Normally Wget gives up on a \s-1URL\s0 when it is unable to connect to the
813
site because failure to connect is taken as a sign that the server is
814
not running at all and that retries would not help. This option is
815
for mirroring unreliable sites whose servers tend to disappear for
816
short periods of time.
817
.IP "\fB\-\-user=\fR\fIuser\fR" 4
818
.IX Item "--user=user"
820
.IP "\fB\-\-password=\fR\fIpassword\fR" 4
821
.IX Item "--password=password"
823
Specify the username \fIuser\fR and password \fIpassword\fR for both
824
\&\s-1FTP\s0 and \s-1HTTP\s0 file retrieval. These parameters can be overridden
825
using the \fB\-\-ftp\-user\fR and \fB\-\-ftp\-password\fR options for
826
\&\s-1FTP\s0 connections and the \fB\-\-http\-user\fR and \fB\-\-http\-password\fR
827
options for \s-1HTTP\s0 connections.
828
.Sh "Directory Options"
829
.IX Subsection "Directory Options"
833
.IP "\fB\-\-no\-directories\fR" 4
834
.IX Item "--no-directories"
836
Do not create a hierarchy of directories when retrieving recursively.
837
With this option turned on, all files will get saved to the current
838
directory, without clobbering (if a name shows up more than once, the
839
filenames will get extensions \fB.n\fR).
843
.IP "\fB\-\-force\-directories\fR" 4
844
.IX Item "--force-directories"
846
The opposite of \fB\-nd\fR\-\-\-create a hierarchy of directories, even if
847
one would not have been created otherwise. E.g. \fBwget \-x
848
http://fly.srk.fer.hr/robots.txt\fR will save the downloaded file to
849
\&\fIfly.srk.fer.hr/robots.txt\fR.
853
.IP "\fB\-\-no\-host\-directories\fR" 4
854
.IX Item "--no-host-directories"
856
Disable generation of host-prefixed directories. By default, invoking
857
Wget with \fB\-r http://fly.srk.fer.hr/\fR will create a structure of
858
directories beginning with \fIfly.srk.fer.hr/\fR. This option disables
860
.IP "\fB\-\-protocol\-directories\fR" 4
861
.IX Item "--protocol-directories"
862
Use the protocol name as a directory component of local file names. For
863
example, with this option, \fBwget \-r http://\fR\fIhost\fR will save to
864
\&\fBhttp/\fR\fIhost\fR\fB/...\fR rather than just to \fIhost\fR\fB/...\fR.
865
.IP "\fB\-\-cut\-dirs=\fR\fInumber\fR" 4
866
.IX Item "--cut-dirs=number"
867
Ignore \fInumber\fR directory components. This is useful for getting a
868
fine-grained control over the directory where recursive retrieval will
871
Take, for example, the directory at
872
\&\fBftp://ftp.xemacs.org/pub/xemacs/\fR. If you retrieve it with
873
\&\fB\-r\fR, it will be saved locally under
874
\&\fIftp.xemacs.org/pub/xemacs/\fR. While the \fB\-nH\fR option can
875
remove the \fIftp.xemacs.org/\fR part, you are still stuck with
876
\&\fIpub/xemacs\fR. This is where \fB\-\-cut\-dirs\fR comes in handy; it
877
makes Wget not \*(L"see\*(R" \fInumber\fR remote directory components. Here
878
are several examples of how \fB\-\-cut\-dirs\fR option works.
881
\& No options \-> ftp.xemacs.org/pub/xemacs/
882
\& \-nH \-> pub/xemacs/
883
\& \-nH \-\-cut\-dirs=1 \-> xemacs/
884
\& \-nH \-\-cut\-dirs=2 \-> .
888
\& \-\-cut\-dirs=1 \-> ftp.xemacs.org/xemacs/
892
If you just want to get rid of the directory structure, this option is
893
similar to a combination of \fB\-nd\fR and \fB\-P\fR. However, unlike
894
\&\fB\-nd\fR, \fB\-\-cut\-dirs\fR does not lose with subdirectories\-\-\-for
895
instance, with \fB\-nH \-\-cut\-dirs=1\fR, a \fIbeta/\fR subdirectory will
896
be placed to \fIxemacs/beta\fR, as one would expect.
897
.IP "\fB\-P\fR \fIprefix\fR" 4
900
.IP "\fB\-\-directory\-prefix=\fR\fIprefix\fR" 4
901
.IX Item "--directory-prefix=prefix"
903
Set directory prefix to \fIprefix\fR. The \fIdirectory prefix\fR is the
904
directory where all other files and subdirectories will be saved to,
905
i.e. the top of the retrieval tree. The default is \fB.\fR (the
907
.Sh "\s-1HTTP\s0 Options"
908
.IX Subsection "HTTP Options"
912
.IP "\fB\-\-html\-extension\fR" 4
913
.IX Item "--html-extension"
915
If a file of type \fBapplication/xhtml+xml\fR or \fBtext/html\fR is
916
downloaded and the \s-1URL\s0 does not end with the regexp
917
\&\fB\e.[Hh][Tt][Mm][Ll]?\fR, this option will cause the suffix \fB.html\fR
918
to be appended to the local filename. This is useful, for instance, when
919
you're mirroring a remote site that uses \fB.asp\fR pages, but you want
920
the mirrored pages to be viewable on your stock Apache server. Another
921
good use for this is when you're downloading CGI-generated materials. A \s-1URL\s0
922
like \fBhttp://site.com/article.cgi?25\fR will be saved as
923
\&\fIarticle.cgi?25.html\fR.
925
Note that filenames changed in this way will be re-downloaded every time
926
you re-mirror a site, because Wget can't tell that the local
927
\&\fI\fIX\fI.html\fR file corresponds to remote \s-1URL\s0 \fIX\fR (since
928
it doesn't yet know that the \s-1URL\s0 produces output of type
929
\&\fBtext/html\fR or \fBapplication/xhtml+xml\fR. To prevent this
930
re\-downloading, you must use \fB\-k\fR and \fB\-K\fR so that the original
931
version of the file will be saved as \fI\fIX\fI.orig\fR.
932
.IP "\fB\-\-http\-user=\fR\fIuser\fR" 4
933
.IX Item "--http-user=user"
935
.IP "\fB\-\-http\-password=\fR\fIpassword\fR" 4
936
.IX Item "--http-password=password"
938
Specify the username \fIuser\fR and password \fIpassword\fR on an
939
\&\s-1HTTP\s0 server. According to the type of the challenge, Wget will
940
encode them using either the \f(CW\*(C`basic\*(C'\fR (insecure),
941
the \f(CW\*(C`digest\*(C'\fR, or the Windows \f(CW\*(C`NTLM\*(C'\fR authentication scheme.
943
Another way to specify username and password is in the \s-1URL\s0 itself. Either method reveals your password to anyone who
944
bothers to run \f(CW\*(C`ps\*(C'\fR. To prevent the passwords from being seen,
945
store them in \fI.wgetrc\fR or \fI.netrc\fR, and make sure to protect
946
those files from other users with \f(CW\*(C`chmod\*(C'\fR. If the passwords are
947
really important, do not leave them lying in those files either\-\-\-edit
948
the files and delete them after Wget has started the download.
949
.IP "\fB\-\-no\-cache\fR" 4
950
.IX Item "--no-cache"
951
Disable server-side cache. In this case, Wget will send the remote
952
server an appropriate directive (\fBPragma: no-cache\fR) to get the
953
file from the remote service, rather than returning the cached version.
954
This is especially useful for retrieving and flushing out-of-date
955
documents on proxy servers.
957
Caching is allowed by default.
958
.IP "\fB\-\-no\-cookies\fR" 4
959
.IX Item "--no-cookies"
960
Disable the use of cookies. Cookies are a mechanism for maintaining
961
server-side state. The server sends the client a cookie using the
962
\&\f(CW\*(C`Set\-Cookie\*(C'\fR header, and the client responds with the same cookie
963
upon further requests. Since cookies allow the server owners to keep
964
track of visitors and for sites to exchange this information, some
965
consider them a breach of privacy. The default is to use cookies;
966
however, \fIstoring\fR cookies is not on by default.
967
.IP "\fB\-\-load\-cookies\fR \fIfile\fR" 4
968
.IX Item "--load-cookies file"
969
Load cookies from \fIfile\fR before the first \s-1HTTP\s0 retrieval.
970
\&\fIfile\fR is a textual file in the format originally used by Netscape's
971
\&\fIcookies.txt\fR file.
973
You will typically use this option when mirroring sites that require
974
that you be logged in to access some or all of their content. The login
975
process typically works by the web server issuing an \s-1HTTP\s0 cookie
976
upon receiving and verifying your credentials. The cookie is then
977
resent by the browser when accessing that part of the site, and so
978
proves your identity.
980
Mirroring such a site requires Wget to send the same cookies your
981
browser sends when communicating with the site. This is achieved by
982
\&\fB\-\-load\-cookies\fR\-\-\-simply point Wget to the location of the
983
\&\fIcookies.txt\fR file, and it will send the same cookies your browser
984
would send in the same situation. Different browsers keep textual
985
cookie files in different locations:
987
.IP "@asis<Netscape 4.x.>" 4
988
.IX Item "@asis<Netscape 4.x.>"
989
The cookies are in \fI~/.netscape/cookies.txt\fR.
990
.IP "@asis<Mozilla and Netscape 6.x.>" 4
991
.IX Item "@asis<Mozilla and Netscape 6.x.>"
992
Mozilla's cookie file is also named \fIcookies.txt\fR, located
993
somewhere under \fI~/.mozilla\fR, in the directory of your profile.
994
The full path usually ends up looking somewhat like
995
\&\fI~/.mozilla/default/\fIsome-weird-string\fI/cookies.txt\fR.
996
.IP "@asis<Internet Explorer.>" 4
997
.IX Item "@asis<Internet Explorer.>"
998
You can produce a cookie file Wget can use by using the File menu,
999
Import and Export, Export Cookies. This has been tested with Internet
1000
Explorer 5; it is not guaranteed to work with earlier versions.
1001
.IP "@asis<Other browsers.>" 4
1002
.IX Item "@asis<Other browsers.>"
1003
If you are using a different browser to create your cookies,
1004
\&\fB\-\-load\-cookies\fR will only work if you can locate or produce a
1005
cookie file in the Netscape format that Wget expects.
1009
If you cannot use \fB\-\-load\-cookies\fR, there might still be an
1010
alternative. If your browser supports a \*(L"cookie manager\*(R", you can use
1011
it to view the cookies used when accessing the site you're mirroring.
1012
Write down the name and value of the cookie, and manually instruct Wget
1013
to send those cookies, bypassing the \*(L"official\*(R" cookie support:
1016
\& wget \-\-no\-cookies \-\-header "Cookie: <name>=<value>"
1019
.IP "\fB\-\-save\-cookies\fR \fIfile\fR" 4
1020
.IX Item "--save-cookies file"
1021
Save cookies to \fIfile\fR before exiting. This will not save cookies
1022
that have expired or that have no expiry time (so\-called \*(L"session
1023
cookies\*(R"), but also see \fB\-\-keep\-session\-cookies\fR.
1024
.IP "\fB\-\-keep\-session\-cookies\fR" 4
1025
.IX Item "--keep-session-cookies"
1026
When specified, causes \fB\-\-save\-cookies\fR to also save session
1027
cookies. Session cookies are normally not saved because they are
1028
meant to be kept in memory and forgotten when you exit the browser.
1029
Saving them is useful on sites that require you to log in or to visit
1030
the home page before you can access some pages. With this option,
1031
multiple Wget runs are considered a single browser session as far as
1032
the site is concerned.
1034
Since the cookie file format does not normally carry session cookies,
1035
Wget marks them with an expiry timestamp of 0. Wget's
1036
\&\fB\-\-load\-cookies\fR recognizes those as session cookies, but it might
1037
confuse other browsers. Also note that cookies so loaded will be
1038
treated as other session cookies, which means that if you want
1039
\&\fB\-\-save\-cookies\fR to preserve them again, you must use
1040
\&\fB\-\-keep\-session\-cookies\fR again.
1041
.IP "\fB\-\-ignore\-length\fR" 4
1042
.IX Item "--ignore-length"
1043
Unfortunately, some \s-1HTTP\s0 servers (\s-1CGI\s0 programs, to be more
1044
precise) send out bogus \f(CW\*(C`Content\-Length\*(C'\fR headers, which makes Wget
1045
go wild, as it thinks not all the document was retrieved. You can spot
1046
this syndrome if Wget retries getting the same document again and again,
1047
each time claiming that the (otherwise normal) connection has closed on
1050
With this option, Wget will ignore the \f(CW\*(C`Content\-Length\*(C'\fR header\-\-\-as
1051
if it never existed.
1052
.IP "\fB\-\-header=\fR\fIheader-line\fR" 4
1053
.IX Item "--header=header-line"
1054
Send \fIheader-line\fR along with the rest of the headers in each
1055
\&\s-1HTTP\s0 request. The supplied header is sent as\-is, which means it
1056
must contain name and value separated by colon, and must not contain
1059
You may define more than one additional header by specifying
1060
\&\fB\-\-header\fR more than once.
1063
\& wget \-\-header=\(aqAccept\-Charset: iso\-8859\-2\(aq \e
1064
\& \-\-header=\(aqAccept\-Language: hr\(aq \e
1065
\& http://fly.srk.fer.hr/
1068
Specification of an empty string as the header value will clear all
1069
previous user-defined headers.
1071
As of Wget 1.10, this option can be used to override headers otherwise
1072
generated automatically. This example instructs Wget to connect to
1073
localhost, but to specify \fBfoo.bar\fR in the \f(CW\*(C`Host\*(C'\fR header:
1076
\& wget \-\-header="Host: foo.bar" http://localhost/
1079
In versions of Wget prior to 1.10 such use of \fB\-\-header\fR caused
1080
sending of duplicate headers.
1081
.IP "\fB\-\-max\-redirect=\fR\fInumber\fR" 4
1082
.IX Item "--max-redirect=number"
1083
Specifies the maximum number of redirections to follow for a resource.
1084
The default is 20, which is usually far more than necessary. However, on
1085
those occasions where you want to allow more (or fewer), this is the
1087
.IP "\fB\-\-proxy\-user=\fR\fIuser\fR" 4
1088
.IX Item "--proxy-user=user"
1090
.IP "\fB\-\-proxy\-password=\fR\fIpassword\fR" 4
1091
.IX Item "--proxy-password=password"
1093
Specify the username \fIuser\fR and password \fIpassword\fR for
1094
authentication on a proxy server. Wget will encode them using the
1095
\&\f(CW\*(C`basic\*(C'\fR authentication scheme.
1097
Security considerations similar to those with \fB\-\-http\-password\fR
1098
pertain here as well.
1099
.IP "\fB\-\-referer=\fR\fIurl\fR" 4
1100
.IX Item "--referer=url"
1101
Include `Referer: \fIurl\fR' header in \s-1HTTP\s0 request. Useful for
1102
retrieving documents with server-side processing that assume they are
1103
always being retrieved by interactive web browsers and only come out
1104
properly when Referer is set to one of the pages that point to them.
1105
.IP "\fB\-\-save\-headers\fR" 4
1106
.IX Item "--save-headers"
1107
Save the headers sent by the \s-1HTTP\s0 server to the file, preceding the
1108
actual contents, with an empty line as the separator.
1109
.IP "\fB\-U\fR \fIagent-string\fR" 4
1110
.IX Item "-U agent-string"
1112
.IP "\fB\-\-user\-agent=\fR\fIagent-string\fR" 4
1113
.IX Item "--user-agent=agent-string"
1115
Identify as \fIagent-string\fR to the \s-1HTTP\s0 server.
1117
The \s-1HTTP\s0 protocol allows the clients to identify themselves using a
1118
\&\f(CW\*(C`User\-Agent\*(C'\fR header field. This enables distinguishing the
1119
\&\s-1WWW\s0 software, usually for statistical purposes or for tracing of
1120
protocol violations. Wget normally identifies as
1121
\&\fBWget/\fR\fIversion\fR, \fIversion\fR being the current version
1124
However, some sites have been known to impose the policy of tailoring
1125
the output according to the \f(CW\*(C`User\-Agent\*(C'\fR\-supplied information.
1126
While this is not such a bad idea in theory, it has been abused by
1127
servers denying information to clients other than (historically)
1128
Netscape or, more frequently, Microsoft Internet Explorer. This
1129
option allows you to change the \f(CW\*(C`User\-Agent\*(C'\fR line issued by Wget.
1130
Use of this option is discouraged, unless you really know what you are
1133
Specifying empty user agent with \fB\-\-user\-agent=""\fR instructs Wget
1134
not to send the \f(CW\*(C`User\-Agent\*(C'\fR header in \s-1HTTP\s0 requests.
1135
.IP "\fB\-\-post\-data=\fR\fIstring\fR" 4
1136
.IX Item "--post-data=string"
1138
.IP "\fB\-\-post\-file=\fR\fIfile\fR" 4
1139
.IX Item "--post-file=file"
1141
Use \s-1POST\s0 as the method for all \s-1HTTP\s0 requests and send the specified data
1142
in the request body. \f(CW\*(C`\-\-post\-data\*(C'\fR sends \fIstring\fR as data,
1143
whereas \f(CW\*(C`\-\-post\-file\*(C'\fR sends the contents of \fIfile\fR. Other than
1144
that, they work in exactly the same way.
1146
Please be aware that Wget needs to know the size of the \s-1POST\s0 data in
1147
advance. Therefore the argument to \f(CW\*(C`\-\-post\-file\*(C'\fR must be a regular
1148
file; specifying a \s-1FIFO\s0 or something like \fI/dev/stdin\fR won't work.
1149
It's not quite clear how to work around this limitation inherent in
1150
\&\s-1HTTP/1\s0.0. Although \s-1HTTP/1\s0.1 introduces \fIchunked\fR transfer that
1151
doesn't require knowing the request length in advance, a client can't
1152
use chunked unless it knows it's talking to an \s-1HTTP/1\s0.1 server. And it
1153
can't know that until it receives a response, which in turn requires the
1154
request to have been completed \*(-- a chicken-and-egg problem.
1156
Note: if Wget is redirected after the \s-1POST\s0 request is completed, it
1157
will not send the \s-1POST\s0 data to the redirected \s-1URL\s0. This is because
1158
URLs that process \s-1POST\s0 often respond with a redirection to a regular
1159
page, which does not desire or accept \s-1POST\s0. It is not completely
1160
clear that this behavior is optimal; if it doesn't work out, it might
1161
be changed in the future.
1163
This example shows how to log to a server using \s-1POST\s0 and then proceed to
1164
download the desired pages, presumably only accessible to authorized
1168
\& # Log in to the server. This can be done only once.
1169
\& wget \-\-save\-cookies cookies.txt \e
1170
\& \-\-post\-data \(aquser=foo&password=bar\(aq \e
1171
\& http://server.com/auth.php
1175
\& # Now grab the page or pages we care about.
1176
\& wget \-\-load\-cookies cookies.txt \e
1177
\& \-p http://server.com/interesting/article.php
1180
If the server is using session cookies to track user authentication,
1181
the above will not work because \fB\-\-save\-cookies\fR will not save
1182
them (and neither will browsers) and the \fIcookies.txt\fR file will
1183
be empty. In that case use \fB\-\-keep\-session\-cookies\fR along with
1184
\&\fB\-\-save\-cookies\fR to force saving of session cookies.
1185
.IP "\fB\-\-content\-disposition\fR" 4
1186
.IX Item "--content-disposition"
1187
If this is set to on, experimental (not fully\-functional) support for
1188
\&\f(CW\*(C`Content\-Disposition\*(C'\fR headers is enabled. This can currently result in
1189
extra round-trips to the server for a \f(CW\*(C`HEAD\*(C'\fR request, and is known
1190
to suffer from a few bugs, which is why it is not currently enabled by default.
1192
This option is useful for some file-downloading \s-1CGI\s0 programs that use
1193
\&\f(CW\*(C`Content\-Disposition\*(C'\fR headers to describe what the name of a
1194
downloaded file should be.
1195
.IP "\fB\-\-auth\-no\-challenge\fR" 4
1196
.IX Item "--auth-no-challenge"
1197
If this option is given, Wget will send Basic \s-1HTTP\s0 authentication
1198
information (plaintext username and password) for all requests, just
1199
like Wget 1.10.2 and prior did by default.
1201
Use of this option is not recommended, and is intended only to support
1202
some few obscure servers, which never send \s-1HTTP\s0 authentication
1203
challenges, but accept unsolicited auth info, say, in addition to
1204
form-based authentication.
1205
.Sh "\s-1HTTPS\s0 (\s-1SSL/TLS\s0) Options"
1206
.IX Subsection "HTTPS (SSL/TLS) Options"
1207
To support encrypted \s-1HTTP\s0 (\s-1HTTPS\s0) downloads, Wget must be compiled
1208
with an external \s-1SSL\s0 library, currently OpenSSL. If Wget is compiled
1209
without \s-1SSL\s0 support, none of these options are available.
1210
.IP "\fB\-\-secure\-protocol=\fR\fIprotocol\fR" 4
1211
.IX Item "--secure-protocol=protocol"
1212
Choose the secure protocol to be used. Legal values are \fBauto\fR,
1213
\&\fBSSLv2\fR, \fBSSLv3\fR, and \fBTLSv1\fR. If \fBauto\fR is used,
1214
the \s-1SSL\s0 library is given the liberty of choosing the appropriate
1215
protocol automatically, which is achieved by sending an SSLv2 greeting
1216
and announcing support for SSLv3 and TLSv1. This is the default.
1218
Specifying \fBSSLv2\fR, \fBSSLv3\fR, or \fBTLSv1\fR forces the use
1219
of the corresponding protocol. This is useful when talking to old and
1220
buggy \s-1SSL\s0 server implementations that make it hard for OpenSSL to
1221
choose the correct protocol version. Fortunately, such servers are
1223
.IP "\fB\-\-no\-check\-certificate\fR" 4
1224
.IX Item "--no-check-certificate"
1225
Don't check the server certificate against the available certificate
1226
authorities. Also don't require the \s-1URL\s0 host name to match the common
1227
name presented by the certificate.
1229
As of Wget 1.10, the default is to verify the server's certificate
1230
against the recognized certificate authorities, breaking the \s-1SSL\s0
1231
handshake and aborting the download if the verification fails.
1232
Although this provides more secure downloads, it does break
1233
interoperability with some sites that worked with previous Wget
1234
versions, particularly those using self\-signed, expired, or otherwise
1235
invalid certificates. This option forces an \*(L"insecure\*(R" mode of
1236
operation that turns the certificate verification errors into warnings
1237
and allows you to proceed.
1239
If you encounter \*(L"certificate verification\*(R" errors or ones saying
1240
that \*(L"common name doesn't match requested host name\*(R", you can use
1241
this option to bypass the verification and proceed with the download.
1242
\&\fIOnly use this option if you are otherwise convinced of the
1243
site's authenticity, or if you really don't care about the validity of
1244
its certificate.\fR It is almost always a bad idea not to check the
1245
certificates when transmitting confidential or important data.
1246
.IP "\fB\-\-certificate=\fR\fIfile\fR" 4
1247
.IX Item "--certificate=file"
1248
Use the client certificate stored in \fIfile\fR. This is needed for
1249
servers that are configured to require certificates from the clients
1250
that connect to them. Normally a certificate is not required and this
1252
.IP "\fB\-\-certificate\-type=\fR\fItype\fR" 4
1253
.IX Item "--certificate-type=type"
1254
Specify the type of the client certificate. Legal values are
1255
\&\fB\s-1PEM\s0\fR (assumed by default) and \fB\s-1DER\s0\fR, also known as
1256
\&\fB\s-1ASN1\s0\fR.
1257
.IP "\fB\-\-private\-key=\fR\fIfile\fR" 4
1258
.IX Item "--private-key=file"
1259
Read the private key from \fIfile\fR. This allows you to provide the
1260
private key in a file separate from the certificate.
1261
.IP "\fB\-\-private\-key\-type=\fR\fItype\fR" 4
1262
.IX Item "--private-key-type=type"
1263
Specify the type of the private key. Accepted values are \fB\s-1PEM\s0\fR
1264
(the default) and \fB\s-1DER\s0\fR.
1265
.IP "\fB\-\-ca\-certificate=\fR\fIfile\fR" 4
1266
.IX Item "--ca-certificate=file"
1267
Use \fIfile\fR as the file with the bundle of certificate authorities
1268
(\*(L"\s-1CA\s0\*(R") to verify the peers. The certificates must be in \s-1PEM\s0 format.
1270
Without this option Wget looks for \s-1CA\s0 certificates at the
1271
system-specified locations, chosen at OpenSSL installation time.
1272
.IP "\fB\-\-ca\-directory=\fR\fIdirectory\fR" 4
1273
.IX Item "--ca-directory=directory"
1274
Specifies directory containing \s-1CA\s0 certificates in \s-1PEM\s0 format. Each
1275
file contains one \s-1CA\s0 certificate, and the file name is based on a hash
1276
value derived from the certificate. This is achieved by processing a
1277
certificate directory with the \f(CW\*(C`c_rehash\*(C'\fR utility supplied with
1278
OpenSSL. Using \fB\-\-ca\-directory\fR is more efficient than
1279
\&\fB\-\-ca\-certificate\fR when many certificates are installed because
1280
it allows Wget to fetch certificates on demand.
1282
Without this option Wget looks for \s-1CA\s0 certificates at the
1283
system-specified locations, chosen at OpenSSL installation time.
1284
.IP "\fB\-\-random\-file=\fR\fIfile\fR" 4
1285
.IX Item "--random-file=file"
1286
Use \fIfile\fR as the source of random data for seeding the
1287
pseudo-random number generator on systems without \fI/dev/random\fR.
1289
On such systems the \s-1SSL\s0 library needs an external source of randomness
1290
to initialize. Randomness may be provided by \s-1EGD\s0 (see
1291
\&\fB\-\-egd\-file\fR below) or read from an external source specified by
1292
the user. If this option is not specified, Wget looks for random data
1293
in \f(CW$RANDFILE\fR or, if that is unset, in \fI$HOME/.rnd\fR. If
1294
none of those are available, it is likely that \s-1SSL\s0 encryption will not
1297
If you're getting the \*(L"Could not seed OpenSSL \s-1PRNG\s0; disabling \s-1SSL\s0.\*(R"
1298
error, you should provide random data using some of the methods
1300
.IP "\fB\-\-egd\-file=\fR\fIfile\fR" 4
1301
.IX Item "--egd-file=file"
1302
Use \fIfile\fR as the \s-1EGD\s0 socket. \s-1EGD\s0 stands for \fIEntropy
1303
Gathering Daemon\fR, a user-space program that collects data from
1304
various unpredictable system sources and makes it available to other
1305
programs that might need it. Encryption software, such as the \s-1SSL\s0
1306
library, needs sources of non-repeating randomness to seed the random
1307
number generator used to produce cryptographically strong keys.
1309
OpenSSL allows the user to specify his own source of entropy using the
1310
\&\f(CW\*(C`RAND_FILE\*(C'\fR environment variable. If this variable is unset, or
1311
if the specified file does not produce enough randomness, OpenSSL will
1312
read random data from \s-1EGD\s0 socket specified using this option.
1314
If this option is not specified (and the equivalent startup command is
1315
not used), \s-1EGD\s0 is never contacted. \s-1EGD\s0 is not needed on modern Unix
1316
systems that support \fI/dev/random\fR.
1317
.Sh "\s-1FTP\s0 Options"
1318
.IX Subsection "FTP Options"
1319
.IP "\fB\-\-ftp\-user=\fR\fIuser\fR" 4
1320
.IX Item "--ftp-user=user"
1322
.IP "\fB\-\-ftp\-password=\fR\fIpassword\fR" 4
1323
.IX Item "--ftp-password=password"
1325
Specify the username \fIuser\fR and password \fIpassword\fR on an
1326
\&\s-1FTP\s0 server. Without this, or the corresponding startup option,
1327
the password defaults to \fB\-wget@\fR, normally used for anonymous
1330
Another way to specify username and password is in the \s-1URL\s0 itself. Either method reveals your password to anyone who
1331
bothers to run \f(CW\*(C`ps\*(C'\fR. To prevent the passwords from being seen,
1332
store them in \fI.wgetrc\fR or \fI.netrc\fR, and make sure to protect
1333
those files from other users with \f(CW\*(C`chmod\*(C'\fR. If the passwords are
1334
really important, do not leave them lying in those files either\-\-\-edit
1335
the files and delete them after Wget has started the download.
1336
.IP "\fB\-\-no\-remove\-listing\fR" 4
1337
.IX Item "--no-remove-listing"
1338
Don't remove the temporary \fI.listing\fR files generated by \s-1FTP\s0
1339
retrievals. Normally, these files contain the raw directory listings
1340
received from \s-1FTP\s0 servers. Not removing them can be useful for
1341
debugging purposes, or when you want to be able to easily check on the
1342
contents of remote server directories (e.g. to verify that a mirror
1343
you're running is complete).
1345
Note that even though Wget writes to a known filename for this file,
1346
this is not a security hole in the scenario of a user making
1347
\&\fI.listing\fR a symbolic link to \fI/etc/passwd\fR or something and
1348
asking \f(CW\*(C`root\*(C'\fR to run Wget in his or her directory. Depending on
1349
the options used, either Wget will refuse to write to \fI.listing\fR,
1350
making the globbing/recursion/time\-stamping operation fail, or the
1351
symbolic link will be deleted and replaced with the actual
1352
\&\fI.listing\fR file, or the listing will be written to a
1353
\&\fI.listing.\fInumber\fI\fR file.
1355
Even though this situation isn't a problem, though, \f(CW\*(C`root\*(C'\fR should
1356
never run Wget in a non-trusted user's directory. A user could do
1357
something as simple as linking \fIindex.html\fR to \fI/etc/passwd\fR
1358
and asking \f(CW\*(C`root\*(C'\fR to run Wget with \fB\-N\fR or \fB\-r\fR so the file
1359
will be overwritten.
1360
.IP "\fB\-\-no\-glob\fR" 4
1361
.IX Item "--no-glob"
1362
Turn off \s-1FTP\s0 globbing. Globbing refers to the use of shell-like
1363
special characters (\fIwildcards\fR), like \fB*\fR, \fB?\fR, \fB[\fR
1364
and \fB]\fR to retrieve more than one file from the same directory at
1368
\& wget ftp://gnjilux.srk.fer.hr/*.msg
1371
By default, globbing will be turned on if the \s-1URL\s0 contains a
1372
globbing character. This option may be used to turn globbing on or off
1375
You may have to quote the \s-1URL\s0 to protect it from being expanded by
1376
your shell. Globbing makes Wget look for a directory listing, which is
1377
system\-specific. This is why it currently works only with Unix \s-1FTP\s0
1378
servers (and the ones emulating Unix \f(CW\*(C`ls\*(C'\fR output).
1379
.IP "\fB\-\-no\-passive\-ftp\fR" 4
1380
.IX Item "--no-passive-ftp"
1381
Disable the use of the \fIpassive\fR \s-1FTP\s0 transfer mode. Passive \s-1FTP\s0
1382
mandates that the client connect to the server to establish the data
1383
connection rather than the other way around.
1385
If the machine is connected to the Internet directly, both passive and
1386
active \s-1FTP\s0 should work equally well. Behind most firewall and \s-1NAT\s0
1387
configurations passive \s-1FTP\s0 has a better chance of working. However,
1388
in some rare firewall configurations, active \s-1FTP\s0 actually works when
1389
passive \s-1FTP\s0 doesn't. If you suspect this to be the case, use this
1390
option, or set \f(CW\*(C`passive_ftp=off\*(C'\fR in your init file.
1391
.IP "\fB\-\-retr\-symlinks\fR" 4
1392
.IX Item "--retr-symlinks"
1393
Usually, when retrieving \s-1FTP\s0 directories recursively and a symbolic
1394
link is encountered, the linked-to file is not downloaded. Instead, a
1395
matching symbolic link is created on the local filesystem. The
1396
pointed-to file will not be downloaded unless this recursive retrieval
1397
would have encountered it separately and downloaded it anyway.
1399
When \fB\-\-retr\-symlinks\fR is specified, however, symbolic links are
1400
traversed and the pointed-to files are retrieved. At this time, this
1401
option does not cause Wget to traverse symlinks to directories and
1402
recurse through them, but in the future it should be enhanced to do
1405
Note that when retrieving a file (not a directory) because it was
1406
specified on the command\-line, rather than because it was recursed to,
1407
this option has no effect. Symbolic links are always traversed in this
1409
.IP "\fB\-\-no\-http\-keep\-alive\fR" 4
1410
.IX Item "--no-http-keep-alive"
1411
Turn off the \*(L"keep\-alive\*(R" feature for \s-1HTTP\s0 downloads. Normally, Wget
1412
asks the server to keep the connection open so that, when you download
1413
more than one document from the same server, they get transferred over
1414
the same \s-1TCP\s0 connection. This saves time and at the same time reduces
1415
the load on the server.
1417
This option is useful when, for some reason, persistent (keep\-alive)
1418
connections don't work for you, for example due to a server bug or due
1419
to the inability of server-side scripts to cope with the connections.
1420
.Sh "Recursive Retrieval Options"
1421
.IX Subsection "Recursive Retrieval Options"
1425
.IP "\fB\-\-recursive\fR" 4
1426
.IX Item "--recursive"
1428
Turn on recursive retrieving.
1429
.IP "\fB\-l\fR \fIdepth\fR" 4
1432
.IP "\fB\-\-level=\fR\fIdepth\fR" 4
1433
.IX Item "--level=depth"
1435
Specify recursion maximum depth level \fIdepth\fR. The default maximum depth is 5.
1436
.IP "\fB\-\-delete\-after\fR" 4
1437
.IX Item "--delete-after"
1438
This option tells Wget to delete every single file it downloads,
1439
\&\fIafter\fR having done so. It is useful for pre-fetching popular
1440
pages through a proxy, e.g.:
1443
\& wget \-r \-nd \-\-delete\-after http://whatever.com/~popular/page/
1446
The \fB\-r\fR option is to retrieve recursively, and \fB\-nd\fR to not
1449
Note that \fB\-\-delete\-after\fR deletes files on the local machine. It
1450
does not issue the \fB\s-1DELE\s0\fR command to remote \s-1FTP\s0 sites, for
1451
instance. Also note that when \fB\-\-delete\-after\fR is specified,
1452
\&\fB\-\-convert\-links\fR is ignored, so \fB.orig\fR files are simply not
1453
created in the first place.
1457
.IP "\fB\-\-convert\-links\fR" 4
1458
.IX Item "--convert-links"
1460
After the download is complete, convert the links in the document to
1461
make them suitable for local viewing. This affects not only the visible
1462
hyperlinks, but any part of the document that links to external content,
1463
such as embedded images, links to style sheets, hyperlinks to non-HTML
1466
Each link will be changed in one of the two ways:
1469
The links to files that have been downloaded by Wget will be changed to
1470
refer to the file they point to as a relative link.
1472
Example: if the downloaded file \fI/foo/doc.html\fR links to
1473
\&\fI/bar/img.gif\fR, also downloaded, then the link in \fIdoc.html\fR
1474
will be modified to point to \fB../bar/img.gif\fR. This kind of
1475
transformation works reliably for arbitrary combinations of directories.
1477
The links to files that have not been downloaded by Wget will be changed
1478
to include host name and absolute path of the location they point to.
1480
Example: if the downloaded file \fI/foo/doc.html\fR links to
1481
\&\fI/bar/img.gif\fR (or to \fI../bar/img.gif\fR), then the link in
1482
\&\fIdoc.html\fR will be modified to point to
1483
\&\fIhttp://\fIhostname\fI/bar/img.gif\fR.
1487
Because of this, local browsing works reliably: if a linked file was
1488
downloaded, the link will refer to its local name; if it was not
1489
downloaded, the link will refer to its full Internet address rather than
1490
presenting a broken link. The fact that the former links are converted
1491
to relative links ensures that you can move the downloaded hierarchy to
1494
Note that only at the end of the download can Wget know which links have
1495
been downloaded. Because of that, the work done by \fB\-k\fR will be
1496
performed at the end of all the downloads.
1501
.IP "\fB\-\-backup\-converted\fR" 4
1502
.IX Item "--backup-converted"
1504
When converting a file, back up the original version with a \fB.orig\fR
1505
suffix. Affects the behavior of \fB\-N\fR.
1509
.IP "\fB\-\-mirror\fR" 4
1512
Turn on options suitable for mirroring. This option turns on recursion
1513
and time\-stamping, sets infinite recursion depth and keeps \s-1FTP\s0
1514
directory listings. It is currently equivalent to
1515
\&\fB\-r \-N \-l inf \-\-no\-remove\-listing\fR.
1519
.IP "\fB\-\-page\-requisites\fR" 4
1520
.IX Item "--page-requisites"
1522
This option causes Wget to download all the files that are necessary to
1523
properly display a given \s-1HTML\s0 page. This includes such things as
1524
inlined images, sounds, and referenced stylesheets.
1526
Ordinarily, when downloading a single \s-1HTML\s0 page, any requisite documents
1527
that may be needed to display it properly are not downloaded. Using
1528
\&\fB\-r\fR together with \fB\-l\fR can help, but since Wget does not
1529
ordinarily distinguish between external and inlined documents, one is
1530
generally left with \*(L"leaf documents\*(R" that are missing their
1533
For instance, say document \fI1.html\fR contains an \f(CW\*(C`<IMG>\*(C'\fR tag
1534
referencing \fI1.gif\fR and an \f(CW\*(C`<A>\*(C'\fR tag pointing to external
1535
document \fI2.html\fR. Say that \fI2.html\fR is similar but that its
1536
image is \fI2.gif\fR and it links to \fI3.html\fR. Say this
1537
continues up to some arbitrarily high number.
1539
If one executes the command:
1542
\& wget \-r \-l 2 http://<site>/1.html
1545
then \fI1.html\fR, \fI1.gif\fR, \fI2.html\fR, \fI2.gif\fR, and
1546
\&\fI3.html\fR will be downloaded. As you can see, \fI3.html\fR is
1547
without its requisite \fI3.gif\fR because Wget is simply counting the
1548
number of hops (up to 2) away from \fI1.html\fR in order to determine
1549
where to stop the recursion. However, with this command:
1552
\& wget \-r \-l 2 \-p http://<site>/1.html
1555
all the above files \fIand\fR \fI3.html\fR's requisite \fI3.gif\fR
1556
will be downloaded. Similarly,
1559
\& wget \-r \-l 1 \-p http://<site>/1.html
1562
will cause \fI1.html\fR, \fI1.gif\fR, \fI2.html\fR, and \fI2.gif\fR
1563
to be downloaded. One might think that:
1566
\& wget \-r \-l 0 \-p http://<site>/1.html
1569
would download just \fI1.html\fR and \fI1.gif\fR, but unfortunately
1570
this is not the case, because \fB\-l 0\fR is equivalent to
1571
\&\fB\-l inf\fR\-\-\-that is, infinite recursion. To download a single \s-1HTML\s0
1572
page (or a handful of them, all specified on the command-line or in a
1573
\&\fB\-i\fR \s-1URL\s0 input file) and its (or their) requisites, simply leave off
1574
\&\fB\-r\fR and \fB\-l\fR:
1577
\& wget \-p http://<site>/1.html
1580
Note that Wget will behave as if \fB\-r\fR had been specified, but only
1581
that single page and its requisites will be downloaded. Links from that
1582
page to external documents will not be followed. Actually, to download
1583
a single page and all its requisites (even if they exist on separate
1584
websites), and make sure the lot displays properly locally, this author
1585
likes to use a few options in addition to \fB\-p\fR:
1588
\& wget \-E \-H \-k \-K \-p http://<site>/<document>
1591
To finish off this topic, it's worth knowing that Wget's idea of an
1592
external document link is any \s-1URL\s0 specified in an \f(CW\*(C`<A>\*(C'\fR tag, an
1593
\&\f(CW\*(C`<AREA>\*(C'\fR tag, or a \f(CW\*(C`<LINK>\*(C'\fR tag other than \f(CW\*(C`<LINK
1594
REL="stylesheet">\*(C'\fR.
1595
.IP "\fB\-\-strict\-comments\fR" 4
1596
.IX Item "--strict-comments"
1597
Turn on strict parsing of \s-1HTML\s0 comments. The default is to terminate
1598
comments at the first occurrence of \fB\-\->\fR.
1600
According to specifications, \s-1HTML\s0 comments are expressed as \s-1SGML\s0
1601
\&\fIdeclarations\fR. Declaration is special markup that begins with
1602
\&\fB<!\fR and ends with \fB>\fR, such as \fB<!DOCTYPE ...>\fR, that
1603
may contain comments between a pair of \fB\-\-\fR delimiters. \s-1HTML\s0
1604
comments are \*(L"empty declarations\*(R", \s-1SGML\s0 declarations without any
1605
non-comment text. Therefore, \fB<!\-\-foo\*(-->\fR is a valid comment, and
1606
so is \fB<!\-\-one\*(-- \-\-two\*(-->\fR, but \fB<!\-\-1\-\-2\-\->\fR is not.
1608
On the other hand, most \s-1HTML\s0 writers don't perceive comments as anything
1609
other than text delimited with \fB<!\-\-\fR and \fB\-\->\fR, which is not
1610
quite the same. For example, something like \fB<!\-\-\-\-\-\-\-\-\-\-\-\->\fR
1611
works as a valid comment as long as the number of dashes is a multiple
1612
of four (!). If not, the comment technically lasts until the next
1613
\&\fB\-\-\fR, which may be at the other end of the document. Because of
1614
this, many popular browsers completely ignore the specification and
1615
implement what users have come to expect: comments delimited with
1616
\&\fB<!\-\-\fR and \fB\-\->\fR.
1618
Until version 1.9, Wget interpreted comments strictly, which resulted in
1619
missing links in many web pages that displayed fine in browsers, but had
1620
the misfortune of containing non-compliant comments. Beginning with
1621
version 1.9, Wget has joined the ranks of clients that implements
1622
\&\*(L"naive\*(R" comments, terminating each comment at the first occurrence of
1625
If, for whatever reason, you want strict comment parsing, use this
1626
option to turn it on.
1627
.Sh "Recursive Accept/Reject Options"
1628
.IX Subsection "Recursive Accept/Reject Options"
1629
.IP "\fB\-A\fR \fIacclist\fR \fB\-\-accept\fR \fIacclist\fR" 4
1630
.IX Item "-A acclist --accept acclist"
1632
.IP "\fB\-R\fR \fIrejlist\fR \fB\-\-reject\fR \fIrejlist\fR" 4
1633
.IX Item "-R rejlist --reject rejlist"
1635
Specify comma-separated lists of file name suffixes or patterns to
1636
accept or reject. Note that if
1637
any of the wildcard characters, \fB*\fR, \fB?\fR, \fB[\fR or
1638
\&\fB]\fR, appear in an element of \fIacclist\fR or \fIrejlist\fR,
1639
it will be treated as a pattern, rather than a suffix.
1640
.IP "\fB\-D\fR \fIdomain-list\fR" 4
1641
.IX Item "-D domain-list"
1643
.IP "\fB\-\-domains=\fR\fIdomain-list\fR" 4
1644
.IX Item "--domains=domain-list"
1646
Set domains to be followed. \fIdomain-list\fR is a comma-separated list
1647
of domains. Note that it does \fInot\fR turn on \fB\-H\fR.
1648
.IP "\fB\-\-exclude\-domains\fR \fIdomain-list\fR" 4
1649
.IX Item "--exclude-domains domain-list"
1650
Specify the domains that are \fInot\fR to be followed..
1651
.IP "\fB\-\-follow\-ftp\fR" 4
1652
.IX Item "--follow-ftp"
1653
Follow \s-1FTP\s0 links from \s-1HTML\s0 documents. Without this option,
1654
Wget will ignore all the \s-1FTP\s0 links.
1655
.IP "\fB\-\-follow\-tags=\fR\fIlist\fR" 4
1656
.IX Item "--follow-tags=list"
1657
Wget has an internal table of \s-1HTML\s0 tag / attribute pairs that it
1658
considers when looking for linked documents during a recursive
1659
retrieval. If a user wants only a subset of those tags to be
1660
considered, however, he or she should be specify such tags in a
1661
comma-separated \fIlist\fR with this option.
1662
.IP "\fB\-\-ignore\-tags=\fR\fIlist\fR" 4
1663
.IX Item "--ignore-tags=list"
1664
This is the opposite of the \fB\-\-follow\-tags\fR option. To skip
1665
certain \s-1HTML\s0 tags when recursively looking for documents to download,
1666
specify them in a comma-separated \fIlist\fR.
1668
In the past, this option was the best bet for downloading a single page
1669
and its requisites, using a command-line like:
1672
\& wget \-\-ignore\-tags=a,area \-H \-k \-K \-r http://<site>/<document>
1675
However, the author of this option came across a page with tags like
1676
\&\f(CW\*(C`<LINK REL="home" HREF="/">\*(C'\fR and came to the realization that
1677
specifying tags to ignore was not enough. One can't just tell Wget to
1678
ignore \f(CW\*(C`<LINK>\*(C'\fR, because then stylesheets will not be downloaded.
1679
Now the best bet for downloading a single page and its requisites is the
1680
dedicated \fB\-\-page\-requisites\fR option.
1681
.IP "\fB\-\-ignore\-case\fR" 4
1682
.IX Item "--ignore-case"
1683
Ignore case when matching files and directories. This influences the
1684
behavior of \-R, \-A, \-I, and \-X options, as well as globbing
1685
implemented when downloading from \s-1FTP\s0 sites. For example, with this
1686
option, \fB\-A *.txt\fR will match \fBfile1.txt\fR, but also
1687
\&\fBfile2.TXT\fR, \fBfile3.TxT\fR, and so on.
1691
.IP "\fB\-\-span\-hosts\fR" 4
1692
.IX Item "--span-hosts"
1694
Enable spanning across hosts when doing recursive retrieving.
1698
.IP "\fB\-\-relative\fR" 4
1699
.IX Item "--relative"
1701
Follow relative links only. Useful for retrieving a specific home page
1702
without any distractions, not even those from the same hosts.
1703
.IP "\fB\-I\fR \fIlist\fR" 4
1706
.IP "\fB\-\-include\-directories=\fR\fIlist\fR" 4
1707
.IX Item "--include-directories=list"
1709
Specify a comma-separated list of directories you wish to follow when
1710
downloading. Elements
1711
of \fIlist\fR may contain wildcards.
1712
.IP "\fB\-X\fR \fIlist\fR" 4
1715
.IP "\fB\-\-exclude\-directories=\fR\fIlist\fR" 4
1716
.IX Item "--exclude-directories=list"
1718
Specify a comma-separated list of directories you wish to exclude from
1719
download. Elements of
1720
\&\fIlist\fR may contain wildcards.
1724
.IP "\fB\-\-no\-parent\fR" 4
1725
.IX Item "--no-parent"
1727
Do not ever ascend to the parent directory when retrieving recursively.
1728
This is a useful option, since it guarantees that only the files
1729
\&\fIbelow\fR a certain hierarchy will be downloaded.
1732
.IP "\fB/usr/local/etc/wgetrc\fR" 4
1733
.IX Item "/usr/local/etc/wgetrc"
1734
Default location of the \fIglobal\fR startup file.
1735
.IP "\fB.wgetrc\fR" 4
1740
You are welcome to submit bug reports via the \s-1GNU\s0 Wget bug tracker (see
1741
<\fBhttp://wget.addictivecode.org/BugTracker\fR>).
1743
Before actually submitting a bug report, please try to follow a few
1746
Please try to ascertain that the behavior you see really is a bug. If
1747
Wget crashes, it's a bug. If Wget does not behave as documented,
1748
it's a bug. If things work strange, but you are not sure about the way
1749
they are supposed to work, it might well be a bug, but you might want to
1750
double-check the documentation and the mailing lists.
1752
Try to repeat the bug in as simple circumstances as possible. E.g. if
1753
Wget crashes while downloading \fBwget \-rl0 \-kKE \-t5 \-\-no\-proxy
1754
http://yoyodyne.com \-o /tmp/log\fR, you should try to see if the crash is
1755
repeatable, and if will occur with a simpler set of options. You might
1756
even try to start the download at the page where the crash occurred to
1757
see if that page somehow triggered the crash.
1759
Also, while I will probably be interested to know the contents of your
1760
\&\fI.wgetrc\fR file, just dumping it into the debug message is probably
1761
a bad idea. Instead, you should first try to see if the bug repeats
1762
with \fI.wgetrc\fR moved out of the way. Only if it turns out that
1763
\&\fI.wgetrc\fR settings affect the bug, mail me the relevant parts of
1766
Please start Wget with \fB\-d\fR option and send us the resulting
1767
output (or relevant parts thereof). If Wget was compiled without
1768
debug support, recompile it\-\-\-it is \fImuch\fR easier to trace bugs
1769
with debug support on.
1771
Note: please make sure to remove any potentially sensitive information
1772
from the debug log before sending it to the bug address. The
1773
\&\f(CW\*(C`\-d\*(C'\fR won't go out of its way to collect sensitive information,
1774
but the log \fIwill\fR contain a fairly complete transcript of Wget's
1775
communication with the server, which may include passwords and pieces
1776
of downloaded data. Since the bug address is publically archived, you
1777
may assume that all bug reports are visible to the public.
1779
If Wget has crashed, try to run it in a debugger, e.g. \f(CW\*(C`gdb `which
1780
wget` core\*(C'\fR and type \f(CW\*(C`where\*(C'\fR to get the backtrace. This may not
1781
work if the system administrator has disabled core files, but it is
1784
.IX Header "SEE ALSO"
1785
This is \fBnot\fR the complete manual for \s-1GNU\s0 Wget.
1786
For more complete information, including more detailed explanations of
1787
some of the options, and a number of commands available
1788
for use with \fI.wgetrc\fR files and the \fB\-e\fR option, see the \s-1GNU\s0
1789
Info entry for \fIwget\fR.
1792
Originally written by Hrvoje Niksic <hniksic@xemacs.org>.
1793
Currently maintained by Micah Cowan <micah@cowan.name>.
1795
.IX Header "COPYRIGHT"
1796
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
1797
2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
1799
Permission is granted to copy, distribute and/or modify this document
1800
under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.2 or
1801
any later version published by the Free Software Foundation; with no
1802
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
1803
copy of the license is included in the section entitled \*(L"\s-1GNU\s0 Free
1804
Documentation License\*(R".