1WGET(1) GNU Wget WGET(1)
2
3
4
6 Wget - The non-interactive network downloader.
7
9 wget [option]... [URL]...
10
12 GNU Wget is a free utility for non-interactive download of files from
13 the Web. It supports HTTP, HTTPS, and FTP protocols, as well as
14 retrieval through HTTP proxies.
15
16 Wget is non-interactive, meaning that it can work in the background,
17 while the user is not logged on. This allows you to start a retrieval
18 and disconnect from the system, letting Wget finish the work. By
19 contrast, most of the Web browsers require constant user's presence,
20 which can be a great hindrance when transferring a lot of data.
21
22 Wget can follow links in HTML, XHTML, and CSS pages, to create local
23 versions of remote web sites, fully recreating the directory structure
24 of the original site. This is sometimes referred to as "recursive
25 downloading." While doing that, Wget respects the Robot Exclusion
26 Standard (/robots.txt). Wget can be instructed to convert the links in
27 downloaded files to point at the local files, for offline viewing.
28
29 Wget has been designed for robustness over slow or unstable network
30 connections; if a download fails due to a network problem, it will keep
31 retrying until the whole file has been retrieved. If the server
32 supports regetting, it will instruct the server to continue the
33 download from where it left off.
34
36 Option Syntax
37 Since Wget uses GNU getopt to process command-line arguments, every
38 option has a long form along with the short one. Long options are more
39 convenient to remember, but take time to type. You may freely mix
40 different option styles, or specify options after the command-line
41 arguments. Thus you may write:
42
43 wget -r --tries=10 http://fly.srk.fer.hr/ -o log
44
45 The space between the option accepting an argument and the argument may
46 be omitted. Instead of -o log you can write -olog.
47
48 You may put several options that do not require arguments together,
49 like:
50
51 wget -drc <URL>
52
53 This is completely equivalent to:
54
55 wget -d -r -c <URL>
56
57 Since the options can be specified after the arguments, you may
58 terminate them with --. So the following will try to download URL -x,
59 reporting failure to log:
60
61 wget -o log -- -x
62
63 The options that accept comma-separated lists all respect the
64 convention that specifying an empty list clears its value. This can be
65 useful to clear the .wgetrc settings. For instance, if your .wgetrc
66 sets "exclude_directories" to /cgi-bin, the following example will
67 first reset it, and then set it to exclude /~nobody and /~somebody.
68 You can also clear the lists in .wgetrc.
69
70 wget -X " -X /~nobody,/~somebody
71
72 Most options that do not accept arguments are boolean options, so named
73 because their state can be captured with a yes-or-no ("boolean")
74 variable. For example, --follow-ftp tells Wget to follow FTP links
75 from HTML files and, on the other hand, --no-glob tells it not to
76 perform file globbing on FTP URLs. A boolean option is either
77 affirmative or negative (beginning with --no). All such options share
78 several properties.
79
80 Unless stated otherwise, it is assumed that the default behavior is the
81 opposite of what the option accomplishes. For example, the documented
82 existence of --follow-ftp assumes that the default is to not follow FTP
83 links from HTML pages.
84
85 Affirmative options can be negated by prepending the --no- to the
86 option name; negative options can be negated by omitting the --no-
87 prefix. This might seem superfluous---if the default for an
88 affirmative option is to not do something, then why provide a way to
89 explicitly turn it off? But the startup file may in fact change the
90 default. For instance, using "follow_ftp = on" in .wgetrc makes Wget
91 follow FTP links by default, and using --no-follow-ftp is the only way
92 to restore the factory default from the command line.
93
94 Basic Startup Options
95 -V
96 --version
97 Display the version of Wget.
98
99 -h
100 --help
101 Print a help message describing all of Wget's command-line options.
102
103 -b
104 --background
105 Go to background immediately after startup. If no output file is
106 specified via the -o, output is redirected to wget-log.
107
108 -e command
109 --execute command
110 Execute command as if it were a part of .wgetrc. A command thus
111 invoked will be executed after the commands in .wgetrc, thus taking
112 precedence over them. If you need to specify more than one wgetrc
113 command, use multiple instances of -e.
114
115 Logging and Input File Options
116 -o logfile
117 --output-file=logfile
118 Log all messages to logfile. The messages are normally reported to
119 standard error.
120
121 -a logfile
122 --append-output=logfile
123 Append to logfile. This is the same as -o, only it appends to
124 logfile instead of overwriting the old log file. If logfile does
125 not exist, a new file is created.
126
127 -d
128 --debug
129 Turn on debug output, meaning various information important to the
130 developers of Wget if it does not work properly. Your system
131 administrator may have chosen to compile Wget without debug
132 support, in which case -d will not work. Please note that
133 compiling with debug support is always safe---Wget compiled with
134 the debug support will not print any debug info unless requested
135 with -d.
136
137 -q
138 --quiet
139 Turn off Wget's output.
140
141 -v
142 --verbose
143 Turn on verbose output, with all the available data. The default
144 output is verbose.
145
146 -nv
147 --no-verbose
148 Turn off verbose without being completely quiet (use -q for that),
149 which means that error messages and basic information still get
150 printed.
151
152 -i file
153 --input-file=file
154 Read URLs from a local or external file. If - is specified as
155 file, URLs are read from the standard input. (Use ./- to read from
156 a file literally named -.)
157
158 If this function is used, no URLs need be present on the command
159 line. If there are URLs both on the command line and in an input
160 file, those on the command lines will be the first ones to be
161 retrieved. If --force-html is not specified, then file should
162 consist of a series of URLs, one per line.
163
164 However, if you specify --force-html, the document will be regarded
165 as html. In that case you may have problems with relative links,
166 which you can solve either by adding "<base href="url">" to the
167 documents or by specifying --base=url on the command line.
168
169 If the file is an external one, the document will be automatically
170 treated as html if the Content-Type matches text/html.
171 Furthermore, the file's location will be implicitly used as base
172 href if none was specified.
173
174 -F
175 --force-html
176 When input is read from a file, force it to be treated as an HTML
177 file. This enables you to retrieve relative links from existing
178 HTML files on your local disk, by adding "<base href="url">" to
179 HTML, or using the --base command-line option.
180
181 -B URL
182 --base=URL
183 Resolves relative links using URL as the point of reference, when
184 reading links from an HTML file specified via the -i/--input-file
185 option (together with --force-html, or when the input file was
186 fetched remotely from a server describing it as HTML). This is
187 equivalent to the presence of a "BASE" tag in the HTML input file,
188 with URL as the value for the "href" attribute.
189
190 For instance, if you specify http://foo/bar/a.html for URL, and
191 Wget reads ../baz/b.html from the input file, it would be resolved
192 to http://foo/baz/b.html.
193
194 Download Options
195 --bind-address=ADDRESS
196 When making client TCP/IP connections, bind to ADDRESS on the local
197 machine. ADDRESS may be specified as a hostname or IP address.
198 This option can be useful if your machine is bound to multiple IPs.
199
200 -t number
201 --tries=number
202 Set number of retries to number. Specify 0 or inf for infinite
203 retrying. The default is to retry 20 times, with the exception of
204 fatal errors like "connection refused" or "not found" (404), which
205 are not retried.
206
207 -O file
208 --output-document=file
209 The documents will not be written to the appropriate files, but all
210 will be concatenated together and written to file. If - is used as
211 file, documents will be printed to standard output, disabling link
212 conversion. (Use ./- to print to a file literally named -.)
213
214 Use of -O is not intended to mean simply "use the name file instead
215 of the one in the URL;" rather, it is analogous to shell
216 redirection: wget -O file http://foo is intended to work like wget
217 -O - http://foo > file; file will be truncated immediately, and all
218 downloaded content will be written there.
219
220 For this reason, -N (for timestamp-checking) is not supported in
221 combination with -O: since file is always newly created, it will
222 always have a very new timestamp. A warning will be issued if this
223 combination is used.
224
225 Similarly, using -r or -p with -O may not work as you expect: Wget
226 won't just download the first file to file and then download the
227 rest to their normal names: all downloaded content will be placed
228 in file. This was disabled in version 1.11, but has been reinstated
229 (with a warning) in 1.11.2, as there are some cases where this
230 behavior can actually have some use.
231
232 Note that a combination with -k is only permitted when downloading
233 a single document, as in that case it will just convert all
234 relative URIs to external ones; -k makes no sense for multiple URIs
235 when they're all being downloaded to a single file.
236
237 -nc
238 --no-clobber
239 If a file is downloaded more than once in the same directory,
240 Wget's behavior depends on a few options, including -nc. In
241 certain cases, the local file will be clobbered, or overwritten,
242 upon repeated download. In other cases it will be preserved.
243
244 When running Wget without -N, -nc, -r, or -p, downloading the same
245 file in the same directory will result in the original copy of file
246 being preserved and the second copy being named file.1. If that
247 file is downloaded yet again, the third copy will be named file.2,
248 and so on. (This is also the behavior with -nd, even if -r or -p
249 are in effect.) When -nc is specified, this behavior is
250 suppressed, and Wget will refuse to download newer copies of file.
251 Therefore, ""no-clobber"" is actually a misnomer in this
252 mode---it's not clobbering that's prevented (as the numeric
253 suffixes were already preventing clobbering), but rather the
254 multiple version saving that's prevented.
255
256 When running Wget with -r or -p, but without -N, -nd, or -nc, re-
257 downloading a file will result in the new copy simply overwriting
258 the old. Adding -nc will prevent this behavior, instead causing
259 the original version to be preserved and any newer copies on the
260 server to be ignored.
261
262 When running Wget with -N, with or without -r or -p, the decision
263 as to whether or not to download a newer copy of a file depends on
264 the local and remote timestamp and size of the file. -nc may not
265 be specified at the same time as -N.
266
267 Note that when -nc is specified, files with the suffixes .html or
268 .htm will be loaded from the local disk and parsed as if they had
269 been retrieved from the Web.
270
271 -c
272 --continue
273 Continue getting a partially-downloaded file. This is useful when
274 you want to finish up a download started by a previous instance of
275 Wget, or by another program. For instance:
276
277 wget -c ftp://sunsite.doc.ic.ac.uk/ls-lR.Z
278
279 If there is a file named ls-lR.Z in the current directory, Wget
280 will assume that it is the first portion of the remote file, and
281 will ask the server to continue the retrieval from an offset equal
282 to the length of the local file.
283
284 Note that you don't need to specify this option if you just want
285 the current invocation of Wget to retry downloading a file should
286 the connection be lost midway through. This is the default
287 behavior. -c only affects resumption of downloads started prior to
288 this invocation of Wget, and whose local files are still sitting
289 around.
290
291 Without -c, the previous example would just download the remote
292 file to ls-lR.Z.1, leaving the truncated ls-lR.Z file alone.
293
294 Beginning with Wget 1.7, if you use -c on a non-empty file, and it
295 turns out that the server does not support continued downloading,
296 Wget will refuse to start the download from scratch, which would
297 effectively ruin existing contents. If you really want the
298 download to start from scratch, remove the file.
299
300 Also beginning with Wget 1.7, if you use -c on a file which is of
301 equal size as the one on the server, Wget will refuse to download
302 the file and print an explanatory message. The same happens when
303 the file is smaller on the server than locally (presumably because
304 it was changed on the server since your last download
305 attempt)---because "continuing" is not meaningful, no download
306 occurs.
307
308 On the other side of the coin, while using -c, any file that's
309 bigger on the server than locally will be considered an incomplete
310 download and only "(length(remote) - length(local))" bytes will be
311 downloaded and tacked onto the end of the local file. This
312 behavior can be desirable in certain cases---for instance, you can
313 use wget -c to download just the new portion that's been appended
314 to a data collection or log file.
315
316 However, if the file is bigger on the server because it's been
317 changed, as opposed to just appended to, you'll end up with a
318 garbled file. Wget has no way of verifying that the local file is
319 really a valid prefix of the remote file. You need to be
320 especially careful of this when using -c in conjunction with -r,
321 since every file will be considered as an "incomplete download"
322 candidate.
323
324 Another instance where you'll get a garbled file if you try to use
325 -c is if you have a lame HTTP proxy that inserts a "transfer
326 interrupted" string into the local file. In the future a
327 "rollback" option may be added to deal with this case.
328
329 Note that -c only works with FTP servers and with HTTP servers that
330 support the "Range" header.
331
332 --progress=type
333 Select the type of the progress indicator you wish to use. Legal
334 indicators are "dot" and "bar".
335
336 The "bar" indicator is used by default. It draws an ASCII progress
337 bar graphics (a.k.a "thermometer" display) indicating the status of
338 retrieval. If the output is not a TTY, the "dot" bar will be used
339 by default.
340
341 Use --progress=dot to switch to the "dot" display. It traces the
342 retrieval by printing dots on the screen, each dot representing a
343 fixed amount of downloaded data.
344
345 When using the dotted retrieval, you may also set the style by
346 specifying the type as dot:style. Different styles assign
347 different meaning to one dot. With the "default" style each dot
348 represents 1K, there are ten dots in a cluster and 50 dots in a
349 line. The "binary" style has a more "computer"-like
350 orientation---8K dots, 16-dots clusters and 48 dots per line (which
351 makes for 384K lines). The "mega" style is suitable for
352 downloading very large files---each dot represents 64K retrieved,
353 there are eight dots in a cluster, and 48 dots on each line (so
354 each line contains 3M).
355
356 Note that you can set the default style using the "progress"
357 command in .wgetrc. That setting may be overridden from the
358 command line. The exception is that, when the output is not a TTY,
359 the "dot" progress will be favored over "bar". To force the bar
360 output, use --progress=bar:force.
361
362 -N
363 --timestamping
364 Turn on time-stamping.
365
366 -S
367 --server-response
368 Print the headers sent by HTTP servers and responses sent by FTP
369 servers.
370
371 --spider
372 When invoked with this option, Wget will behave as a Web spider,
373 which means that it will not download the pages, just check that
374 they are there. For example, you can use Wget to check your
375 bookmarks:
376
377 wget --spider --force-html -i bookmarks.html
378
379 This feature needs much more work for Wget to get close to the
380 functionality of real web spiders.
381
382 -T seconds
383 --timeout=seconds
384 Set the network timeout to seconds seconds. This is equivalent to
385 specifying --dns-timeout, --connect-timeout, and --read-timeout,
386 all at the same time.
387
388 When interacting with the network, Wget can check for timeout and
389 abort the operation if it takes too long. This prevents anomalies
390 like hanging reads and infinite connects. The only timeout enabled
391 by default is a 900-second read timeout. Setting a timeout to 0
392 disables it altogether. Unless you know what you are doing, it is
393 best not to change the default timeout settings.
394
395 All timeout-related options accept decimal values, as well as
396 subsecond values. For example, 0.1 seconds is a legal (though
397 unwise) choice of timeout. Subsecond timeouts are useful for
398 checking server response times or for testing network latency.
399
400 --dns-timeout=seconds
401 Set the DNS lookup timeout to seconds seconds. DNS lookups that
402 don't complete within the specified time will fail. By default,
403 there is no timeout on DNS lookups, other than that implemented by
404 system libraries.
405
406 --connect-timeout=seconds
407 Set the connect timeout to seconds seconds. TCP connections that
408 take longer to establish will be aborted. By default, there is no
409 connect timeout, other than that implemented by system libraries.
410
411 --read-timeout=seconds
412 Set the read (and write) timeout to seconds seconds. The "time" of
413 this timeout refers to idle time: if, at any point in the download,
414 no data is received for more than the specified number of seconds,
415 reading fails and the download is restarted. This option does not
416 directly affect the duration of the entire download.
417
418 Of course, the remote server may choose to terminate the connection
419 sooner than this option requires. The default read timeout is 900
420 seconds.
421
422 --limit-rate=amount
423 Limit the download speed to amount bytes per second. Amount may be
424 expressed in bytes, kilobytes with the k suffix, or megabytes with
425 the m suffix. For example, --limit-rate=20k will limit the
426 retrieval rate to 20KB/s. This is useful when, for whatever
427 reason, you don't want Wget to consume the entire available
428 bandwidth.
429
430 This option allows the use of decimal numbers, usually in
431 conjunction with power suffixes; for example, --limit-rate=2.5k is
432 a legal value.
433
434 Note that Wget implements the limiting by sleeping the appropriate
435 amount of time after a network read that took less time than
436 specified by the rate. Eventually this strategy causes the TCP
437 transfer to slow down to approximately the specified rate.
438 However, it may take some time for this balance to be achieved, so
439 don't be surprised if limiting the rate doesn't work well with very
440 small files.
441
442 -w seconds
443 --wait=seconds
444 Wait the specified number of seconds between the retrievals. Use
445 of this option is recommended, as it lightens the server load by
446 making the requests less frequent. Instead of in seconds, the time
447 can be specified in minutes using the "m" suffix, in hours using
448 "h" suffix, or in days using "d" suffix.
449
450 Specifying a large value for this option is useful if the network
451 or the destination host is down, so that Wget can wait long enough
452 to reasonably expect the network error to be fixed before the
453 retry. The waiting interval specified by this function is
454 influenced by "--random-wait", which see.
455
456 --waitretry=seconds
457 If you don't want Wget to wait between every retrieval, but only
458 between retries of failed downloads, you can use this option. Wget
459 will use linear backoff, waiting 1 second after the first failure
460 on a given file, then waiting 2 seconds after the second failure on
461 that file, up to the maximum number of seconds you specify.
462 Therefore, a value of 10 will actually make Wget wait up to (1 + 2
463 + ... + 10) = 55 seconds per file.
464
465 By default, Wget will assume a value of 10 seconds.
466
467 --random-wait
468 Some web sites may perform log analysis to identify retrieval
469 programs such as Wget by looking for statistically significant
470 similarities in the time between requests. This option causes the
471 time between requests to vary between 0.5 and 1.5 * wait seconds,
472 where wait was specified using the --wait option, in order to mask
473 Wget's presence from such analysis.
474
475 A 2001 article in a publication devoted to development on a popular
476 consumer platform provided code to perform this analysis on the
477 fly. Its author suggested blocking at the class C address level to
478 ensure automated retrieval programs were blocked despite changing
479 DHCP-supplied addresses.
480
481 The --random-wait option was inspired by this ill-advised
482 recommendation to block many unrelated users from a web site due to
483 the actions of one.
484
485 --no-proxy
486 Don't use proxies, even if the appropriate *_proxy environment
487 variable is defined.
488
489 -Q quota
490 --quota=quota
491 Specify download quota for automatic retrievals. The value can be
492 specified in bytes (default), kilobytes (with k suffix), or
493 megabytes (with m suffix).
494
495 Note that quota will never affect downloading a single file. So if
496 you specify wget -Q10k ftp://wuarchive.wustl.edu/ls-lR.gz, all of
497 the ls-lR.gz will be downloaded. The same goes even when several
498 URLs are specified on the command-line. However, quota is
499 respected when retrieving either recursively, or from an input
500 file. Thus you may safely type wget -Q2m -i sites---download will
501 be aborted when the quota is exceeded.
502
503 Setting quota to 0 or to inf unlimits the download quota.
504
505 --no-dns-cache
506 Turn off caching of DNS lookups. Normally, Wget remembers the IP
507 addresses it looked up from DNS so it doesn't have to repeatedly
508 contact the DNS server for the same (typically small) set of hosts
509 it retrieves from. This cache exists in memory only; a new Wget
510 run will contact DNS again.
511
512 However, it has been reported that in some situations it is not
513 desirable to cache host names, even for the duration of a short-
514 running application like Wget. With this option Wget issues a new
515 DNS lookup (more precisely, a new call to "gethostbyname" or
516 "getaddrinfo") each time it makes a new connection. Please note
517 that this option will not affect caching that might be performed by
518 the resolving library or by an external caching layer, such as
519 NSCD.
520
521 If you don't understand exactly what this option does, you probably
522 won't need it.
523
524 --restrict-file-names=modes
525 Change which characters found in remote URLs must be escaped during
526 generation of local filenames. Characters that are restricted by
527 this option are escaped, i.e. replaced with %HH, where HH is the
528 hexadecimal number that corresponds to the restricted character.
529 This option may also be used to force all alphabetical cases to be
530 either lower- or uppercase.
531
532 By default, Wget escapes the characters that are not valid or safe
533 as part of file names on your operating system, as well as control
534 characters that are typically unprintable. This option is useful
535 for changing these defaults, perhaps because you are downloading to
536 a non-native partition, or because you want to disable escaping of
537 the control characters, or you want to further restrict characters
538 to only those in the ASCII range of values.
539
540 The modes are a comma-separated set of text values. The acceptable
541 values are unix, windows, nocontrol, ascii, lowercase, and
542 uppercase. The values unix and windows are mutually exclusive (one
543 will override the other), as are lowercase and uppercase. Those
544 last are special cases, as they do not change the set of characters
545 that would be escaped, but rather force local file paths to be
546 converted either to lower- or uppercase.
547
548 When "unix" is specified, Wget escapes the character / and the
549 control characters in the ranges 0--31 and 128--159. This is the
550 default on Unix-like operating systems.
551
552 When "windows" is given, Wget escapes the characters \, |, /, :, ?,
553 ", *, <, >, and the control characters in the ranges 0--31 and
554 128--159. In addition to this, Wget in Windows mode uses + instead
555 of : to separate host and port in local file names, and uses @
556 instead of ? to separate the query portion of the file name from
557 the rest. Therefore, a URL that would be saved as
558 www.xemacs.org:4300/search.pl?input=blah in Unix mode would be
559 saved as www.xemacs.org+4300/search.pl@input=blah in Windows mode.
560 This mode is the default on Windows.
561
562 If you specify nocontrol, then the escaping of the control
563 characters is also switched off. This option may make sense when
564 you are downloading URLs whose names contain UTF-8 characters, on a
565 system which can save and display filenames in UTF-8 (some possible
566 byte values used in UTF-8 byte sequences fall in the range of
567 values designated by Wget as "controls").
568
569 The ascii mode is used to specify that any bytes whose values are
570 outside the range of ASCII characters (that is, greater than 127)
571 shall be escaped. This can be useful when saving filenames whose
572 encoding does not match the one used locally.
573
574 -4
575 --inet4-only
576 -6
577 --inet6-only
578 Force connecting to IPv4 or IPv6 addresses. With --inet4-only or
579 -4, Wget will only connect to IPv4 hosts, ignoring AAAA records in
580 DNS, and refusing to connect to IPv6 addresses specified in URLs.
581 Conversely, with --inet6-only or -6, Wget will only connect to IPv6
582 hosts and ignore A records and IPv4 addresses.
583
584 Neither options should be needed normally. By default, an
585 IPv6-aware Wget will use the address family specified by the host's
586 DNS record. If the DNS responds with both IPv4 and IPv6 addresses,
587 Wget will try them in sequence until it finds one it can connect
588 to. (Also see "--prefer-family" option described below.)
589
590 These options can be used to deliberately force the use of IPv4 or
591 IPv6 address families on dual family systems, usually to aid
592 debugging or to deal with broken network configuration. Only one
593 of --inet6-only and --inet4-only may be specified at the same time.
594 Neither option is available in Wget compiled without IPv6 support.
595
596 --prefer-family=none/IPv4/IPv6
597 When given a choice of several addresses, connect to the addresses
598 with specified address family first. The address order returned by
599 DNS is used without change by default.
600
601 This avoids spurious errors and connect attempts when accessing
602 hosts that resolve to both IPv6 and IPv4 addresses from IPv4
603 networks. For example, www.kame.net resolves to
604 2001:200:0:8002:203:47ff:fea5:3085 and to 203.178.141.194. When
605 the preferred family is "IPv4", the IPv4 address is used first;
606 when the preferred family is "IPv6", the IPv6 address is used
607 first; if the specified value is "none", the address order returned
608 by DNS is used without change.
609
610 Unlike -4 and -6, this option doesn't inhibit access to any address
611 family, it only changes the order in which the addresses are
612 accessed. Also note that the reordering performed by this option
613 is stable---it doesn't affect order of addresses of the same
614 family. That is, the relative order of all IPv4 addresses and of
615 all IPv6 addresses remains intact in all cases.
616
617 --retry-connrefused
618 Consider "connection refused" a transient error and try again.
619 Normally Wget gives up on a URL when it is unable to connect to the
620 site because failure to connect is taken as a sign that the server
621 is not running at all and that retries would not help. This option
622 is for mirroring unreliable sites whose servers tend to disappear
623 for short periods of time.
624
625 --user=user
626 --password=password
627 Specify the username user and password password for both FTP and
628 HTTP file retrieval. These parameters can be overridden using the
629 --ftp-user and --ftp-password options for FTP connections and the
630 --http-user and --http-password options for HTTP connections.
631
632 --ask-password
633 Prompt for a password for each connection established. Cannot be
634 specified when --password is being used, because they are mutually
635 exclusive.
636
637 --no-iri
638 Turn off internationalized URI (IRI) support. Use --iri to turn it
639 on. IRI support is activated by default.
640
641 You can set the default state of IRI support using the "iri"
642 command in .wgetrc. That setting may be overridden from the command
643 line.
644
645 --local-encoding=encoding
646 Force Wget to use encoding as the default system encoding. That
647 affects how Wget converts URLs specified as arguments from locale
648 to UTF-8 for IRI support.
649
650 Wget use the function "nl_langinfo()" and then the "CHARSET"
651 environment variable to get the locale. If it fails, ASCII is used.
652
653 You can set the default local encoding using the "local_encoding"
654 command in .wgetrc. That setting may be overridden from the command
655 line.
656
657 --remote-encoding=encoding
658 Force Wget to use encoding as the default remote server encoding.
659 That affects how Wget converts URIs found in files from remote
660 encoding to UTF-8 during a recursive fetch. This options is only
661 useful for IRI support, for the interpretation of non-ASCII
662 characters.
663
664 For HTTP, remote encoding can be found in HTTP "Content-Type"
665 header and in HTML "Content-Type http-equiv" meta tag.
666
667 You can set the default encoding using the "remoteencoding" command
668 in .wgetrc. That setting may be overridden from the command line.
669
670 Directory Options
671 -nd
672 --no-directories
673 Do not create a hierarchy of directories when retrieving
674 recursively. With this option turned on, all files will get saved
675 to the current directory, without clobbering (if a name shows up
676 more than once, the filenames will get extensions .n).
677
678 -x
679 --force-directories
680 The opposite of -nd---create a hierarchy of directories, even if
681 one would not have been created otherwise. E.g. wget -x
682 http://fly.srk.fer.hr/robots.txt will save the downloaded file to
683 fly.srk.fer.hr/robots.txt.
684
685 -nH
686 --no-host-directories
687 Disable generation of host-prefixed directories. By default,
688 invoking Wget with -r http://fly.srk.fer.hr/ will create a
689 structure of directories beginning with fly.srk.fer.hr/. This
690 option disables such behavior.
691
692 --protocol-directories
693 Use the protocol name as a directory component of local file names.
694 For example, with this option, wget -r http://host will save to
695 http/host/... rather than just to host/....
696
697 --cut-dirs=number
698 Ignore number directory components. This is useful for getting a
699 fine-grained control over the directory where recursive retrieval
700 will be saved.
701
702 Take, for example, the directory at
703 ftp://ftp.xemacs.org/pub/xemacs/. If you retrieve it with -r, it
704 will be saved locally under ftp.xemacs.org/pub/xemacs/. While the
705 -nH option can remove the ftp.xemacs.org/ part, you are still stuck
706 with pub/xemacs. This is where --cut-dirs comes in handy; it makes
707 Wget not "see" number remote directory components. Here are
708 several examples of how --cut-dirs option works.
709
710 No options -> ftp.xemacs.org/pub/xemacs/
711 -nH -> pub/xemacs/
712 -nH --cut-dirs=1 -> xemacs/
713 -nH --cut-dirs=2 -> .
714
715 --cut-dirs=1 -> ftp.xemacs.org/xemacs/
716 ...
717
718 If you just want to get rid of the directory structure, this option
719 is similar to a combination of -nd and -P. However, unlike -nd,
720 --cut-dirs does not lose with subdirectories---for instance, with
721 -nH --cut-dirs=1, a beta/ subdirectory will be placed to
722 xemacs/beta, as one would expect.
723
724 -P prefix
725 --directory-prefix=prefix
726 Set directory prefix to prefix. The directory prefix is the
727 directory where all other files and subdirectories will be saved
728 to, i.e. the top of the retrieval tree. The default is . (the
729 current directory).
730
731 HTTP Options
732 --default-page=name
733 Use name as the default file name when it isn't known (i.e., for
734 URLs that end in a slash), instead of index.html.
735
736 -E
737 --adjust-extension
738 If a file of type application/xhtml+xml or text/html is downloaded
739 and the URL does not end with the regexp \.[Hh][Tt][Mm][Ll]?, this
740 option will cause the suffix .html to be appended to the local
741 filename. This is useful, for instance, when you're mirroring a
742 remote site that uses .asp pages, but you want the mirrored pages
743 to be viewable on your stock Apache server. Another good use for
744 this is when you're downloading CGI-generated materials. A URL
745 like http://site.com/article.cgi?25 will be saved as
746 article.cgi?25.html.
747
748 Note that filenames changed in this way will be re-downloaded every
749 time you re-mirror a site, because Wget can't tell that the local
750 X.html file corresponds to remote URL X (since it doesn't yet know
751 that the URL produces output of type text/html or
752 application/xhtml+xml. To prevent this re-downloading, you must
753 use -k and -K so that the original version of the file will be
754 saved as X.orig.
755
756 As of version 1.12, Wget will also ensure that any downloaded files
757 of type text/css end in the suffix .css, and the option was renamed
758 from --html-extension, to better reflect its new behavior. The old
759 option name is still acceptable, but should now be considered
760 deprecated.
761
762 At some point in the future, this option may well be expanded to
763 include suffixes for other types of content, including content
764 types that are not parsed by Wget.
765
766 --http-user=user
767 --http-password=password
768 Specify the username user and password password on an HTTP server.
769 According to the type of the challenge, Wget will encode them using
770 either the "basic" (insecure), the "digest", or the Windows "NTLM"
771 authentication scheme.
772
773 Another way to specify username and password is in the URL itself.
774 Either method reveals your password to anyone who bothers to run
775 "ps". To prevent the passwords from being seen, store them in
776 .wgetrc or .netrc, and make sure to protect those files from other
777 users with "chmod". If the passwords are really important, do not
778 leave them lying in those files either---edit the files and delete
779 them after Wget has started the download.
780
781 --no-http-keep-alive
782 Turn off the "keep-alive" feature for HTTP downloads. Normally,
783 Wget asks the server to keep the connection open so that, when you
784 download more than one document from the same server, they get
785 transferred over the same TCP connection. This saves time and at
786 the same time reduces the load on the server.
787
788 This option is useful when, for some reason, persistent (keep-
789 alive) connections don't work for you, for example due to a server
790 bug or due to the inability of server-side scripts to cope with the
791 connections.
792
793 --no-cache
794 Disable server-side cache. In this case, Wget will send the remote
795 server an appropriate directive (Pragma: no-cache) to get the file
796 from the remote service, rather than returning the cached version.
797 This is especially useful for retrieving and flushing out-of-date
798 documents on proxy servers.
799
800 Caching is allowed by default.
801
802 --no-cookies
803 Disable the use of cookies. Cookies are a mechanism for
804 maintaining server-side state. The server sends the client a
805 cookie using the "Set-Cookie" header, and the client responds with
806 the same cookie upon further requests. Since cookies allow the
807 server owners to keep track of visitors and for sites to exchange
808 this information, some consider them a breach of privacy. The
809 default is to use cookies; however, storing cookies is not on by
810 default.
811
812 --load-cookies file
813 Load cookies from file before the first HTTP retrieval. file is a
814 textual file in the format originally used by Netscape's
815 cookies.txt file.
816
817 You will typically use this option when mirroring sites that
818 require that you be logged in to access some or all of their
819 content. The login process typically works by the web server
820 issuing an HTTP cookie upon receiving and verifying your
821 credentials. The cookie is then resent by the browser when
822 accessing that part of the site, and so proves your identity.
823
824 Mirroring such a site requires Wget to send the same cookies your
825 browser sends when communicating with the site. This is achieved
826 by --load-cookies---simply point Wget to the location of the
827 cookies.txt file, and it will send the same cookies your browser
828 would send in the same situation. Different browsers keep textual
829 cookie files in different locations:
830
831 Netscape 4.x.
832 The cookies are in ~/.netscape/cookies.txt.
833
834 Mozilla and Netscape 6.x.
835 Mozilla's cookie file is also named cookies.txt, located
836 somewhere under ~/.mozilla, in the directory of your profile.
837 The full path usually ends up looking somewhat like
838 ~/.mozilla/default/some-weird-string/cookies.txt.
839
840 Internet Explorer.
841 You can produce a cookie file Wget can use by using the File
842 menu, Import and Export, Export Cookies. This has been tested
843 with Internet Explorer 5; it is not guaranteed to work with
844 earlier versions.
845
846 Other browsers.
847 If you are using a different browser to create your cookies,
848 --load-cookies will only work if you can locate or produce a
849 cookie file in the Netscape format that Wget expects.
850
851 If you cannot use --load-cookies, there might still be an
852 alternative. If your browser supports a "cookie manager", you can
853 use it to view the cookies used when accessing the site you're
854 mirroring. Write down the name and value of the cookie, and
855 manually instruct Wget to send those cookies, bypassing the
856 "official" cookie support:
857
858 wget --no-cookies --header "Cookie: <name>=<value>"
859
860 --save-cookies file
861 Save cookies to file before exiting. This will not save cookies
862 that have expired or that have no expiry time (so-called "session
863 cookies"), but also see --keep-session-cookies.
864
865 --keep-session-cookies
866 When specified, causes --save-cookies to also save session cookies.
867 Session cookies are normally not saved because they are meant to be
868 kept in memory and forgotten when you exit the browser. Saving
869 them is useful on sites that require you to log in or to visit the
870 home page before you can access some pages. With this option,
871 multiple Wget runs are considered a single browser session as far
872 as the site is concerned.
873
874 Since the cookie file format does not normally carry session
875 cookies, Wget marks them with an expiry timestamp of 0. Wget's
876 --load-cookies recognizes those as session cookies, but it might
877 confuse other browsers. Also note that cookies so loaded will be
878 treated as other session cookies, which means that if you want
879 --save-cookies to preserve them again, you must use
880 --keep-session-cookies again.
881
882 --ignore-length
883 Unfortunately, some HTTP servers (CGI programs, to be more precise)
884 send out bogus "Content-Length" headers, which makes Wget go wild,
885 as it thinks not all the document was retrieved. You can spot this
886 syndrome if Wget retries getting the same document again and again,
887 each time claiming that the (otherwise normal) connection has
888 closed on the very same byte.
889
890 With this option, Wget will ignore the "Content-Length" header---as
891 if it never existed.
892
893 --header=header-line
894 Send header-line along with the rest of the headers in each HTTP
895 request. The supplied header is sent as-is, which means it must
896 contain name and value separated by colon, and must not contain
897 newlines.
898
899 You may define more than one additional header by specifying
900 --header more than once.
901
902 wget --header='Accept-Charset: iso-8859-2' \
903 --header='Accept-Language: hr' \
904 http://fly.srk.fer.hr/
905
906 Specification of an empty string as the header value will clear all
907 previous user-defined headers.
908
909 As of Wget 1.10, this option can be used to override headers
910 otherwise generated automatically. This example instructs Wget to
911 connect to localhost, but to specify foo.bar in the "Host" header:
912
913 wget --header="Host: foo.bar" http://localhost/
914
915 In versions of Wget prior to 1.10 such use of --header caused
916 sending of duplicate headers.
917
918 --max-redirect=number
919 Specifies the maximum number of redirections to follow for a
920 resource. The default is 20, which is usually far more than
921 necessary. However, on those occasions where you want to allow more
922 (or fewer), this is the option to use.
923
924 --proxy-user=user
925 --proxy-password=password
926 Specify the username user and password password for authentication
927 on a proxy server. Wget will encode them using the "basic"
928 authentication scheme.
929
930 Security considerations similar to those with --http-password
931 pertain here as well.
932
933 --referer=url
934 Include `Referer: url' header in HTTP request. Useful for
935 retrieving documents with server-side processing that assume they
936 are always being retrieved by interactive web browsers and only
937 come out properly when Referer is set to one of the pages that
938 point to them.
939
940 --save-headers
941 Save the headers sent by the HTTP server to the file, preceding the
942 actual contents, with an empty line as the separator.
943
944 -U agent-string
945 --user-agent=agent-string
946 Identify as agent-string to the HTTP server.
947
948 The HTTP protocol allows the clients to identify themselves using a
949 "User-Agent" header field. This enables distinguishing the WWW
950 software, usually for statistical purposes or for tracing of
951 protocol violations. Wget normally identifies as Wget/version,
952 version being the current version number of Wget.
953
954 However, some sites have been known to impose the policy of
955 tailoring the output according to the "User-Agent"-supplied
956 information. While this is not such a bad idea in theory, it has
957 been abused by servers denying information to clients other than
958 (historically) Netscape or, more frequently, Microsoft Internet
959 Explorer. This option allows you to change the "User-Agent" line
960 issued by Wget. Use of this option is discouraged, unless you
961 really know what you are doing.
962
963 Specifying empty user agent with --user-agent="" instructs Wget not
964 to send the "User-Agent" header in HTTP requests.
965
966 --post-data=string
967 --post-file=file
968 Use POST as the method for all HTTP requests and send the specified
969 data in the request body. --post-data sends string as data,
970 whereas --post-file sends the contents of file. Other than that,
971 they work in exactly the same way. In particular, they both expect
972 content of the form "key1=value1&key2=value2", with percent-
973 encoding for special characters; the only difference is that one
974 expects its content as a command-line paramter and the other
975 accepts its content from a file. In particular, --post-file is not
976 for transmitting files as form attachments: those must appear as
977 "key=value" data (with appropriate percent-coding) just like
978 everything else. Wget does not currently support
979 "multipart/form-data" for transmitting POST data; only
980 "application/x-www-form-urlencoded". Only one of --post-data and
981 --post-file should be specified.
982
983 Please be aware that Wget needs to know the size of the POST data
984 in advance. Therefore the argument to "--post-file" must be a
985 regular file; specifying a FIFO or something like /dev/stdin won't
986 work. It's not quite clear how to work around this limitation
987 inherent in HTTP/1.0. Although HTTP/1.1 introduces chunked
988 transfer that doesn't require knowing the request length in
989 advance, a client can't use chunked unless it knows it's talking to
990 an HTTP/1.1 server. And it can't know that until it receives a
991 response, which in turn requires the request to have been completed
992 -- a chicken-and-egg problem.
993
994 Note: if Wget is redirected after the POST request is completed, it
995 will not send the POST data to the redirected URL. This is because
996 URLs that process POST often respond with a redirection to a
997 regular page, which does not desire or accept POST. It is not
998 completely clear that this behavior is optimal; if it doesn't work
999 out, it might be changed in the future.
1000
1001 This example shows how to log to a server using POST and then
1002 proceed to download the desired pages, presumably only accessible
1003 to authorized users:
1004
1005 # Log in to the server. This can be done only once.
1006 wget --save-cookies cookies.txt \
1007 --post-data 'user=foo&password=bar' \
1008 http://server.com/auth.php
1009
1010 # Now grab the page or pages we care about.
1011 wget --load-cookies cookies.txt \
1012 -p http://server.com/interesting/article.php
1013
1014 If the server is using session cookies to track user
1015 authentication, the above will not work because --save-cookies will
1016 not save them (and neither will browsers) and the cookies.txt file
1017 will be empty. In that case use --keep-session-cookies along with
1018 --save-cookies to force saving of session cookies.
1019
1020 --content-disposition
1021 If this is set to on, experimental (not fully-functional) support
1022 for "Content-Disposition" headers is enabled. This can currently
1023 result in extra round-trips to the server for a "HEAD" request, and
1024 is known to suffer from a few bugs, which is why it is not
1025 currently enabled by default.
1026
1027 This option is useful for some file-downloading CGI programs that
1028 use "Content-Disposition" headers to describe what the name of a
1029 downloaded file should be.
1030
1031 --trust-server-names
1032 If this is set to on, on a redirect the last component of the
1033 redirection URL will be used as the local file name. By default
1034 the last component in the original URL is used.
1035
1036 --auth-no-challenge
1037 If this option is given, Wget will send Basic HTTP authentication
1038 information (plaintext username and password) for all requests,
1039 just like Wget 1.10.2 and prior did by default.
1040
1041 Use of this option is not recommended, and is intended only to
1042 support some few obscure servers, which never send HTTP
1043 authentication challenges, but accept unsolicited auth info, say,
1044 in addition to form-based authentication.
1045
1046 HTTPS (SSL/TLS) Options
1047 To support encrypted HTTP (HTTPS) downloads, Wget must be compiled with
1048 an external SSL library, currently OpenSSL. If Wget is compiled
1049 without SSL support, none of these options are available.
1050
1051 --secure-protocol=protocol
1052 Choose the secure protocol to be used. Legal values are auto,
1053 SSLv2, SSLv3, and TLSv1. If auto is used, the SSL library is given
1054 the liberty of choosing the appropriate protocol automatically,
1055 which is achieved by sending an SSLv2 greeting and announcing
1056 support for SSLv3 and TLSv1. This is the default.
1057
1058 Specifying SSLv2, SSLv3, or TLSv1 forces the use of the
1059 corresponding protocol. This is useful when talking to old and
1060 buggy SSL server implementations that make it hard for OpenSSL to
1061 choose the correct protocol version. Fortunately, such servers are
1062 quite rare.
1063
1064 --no-check-certificate
1065 Don't check the server certificate against the available
1066 certificate authorities. Also don't require the URL host name to
1067 match the common name presented by the certificate.
1068
1069 As of Wget 1.10, the default is to verify the server's certificate
1070 against the recognized certificate authorities, breaking the SSL
1071 handshake and aborting the download if the verification fails.
1072 Although this provides more secure downloads, it does break
1073 interoperability with some sites that worked with previous Wget
1074 versions, particularly those using self-signed, expired, or
1075 otherwise invalid certificates. This option forces an "insecure"
1076 mode of operation that turns the certificate verification errors
1077 into warnings and allows you to proceed.
1078
1079 If you encounter "certificate verification" errors or ones saying
1080 that "common name doesn't match requested host name", you can use
1081 this option to bypass the verification and proceed with the
1082 download. Only use this option if you are otherwise convinced of
1083 the site's authenticity, or if you really don't care about the
1084 validity of its certificate. It is almost always a bad idea not to
1085 check the certificates when transmitting confidential or important
1086 data.
1087
1088 --certificate=file
1089 Use the client certificate stored in file. This is needed for
1090 servers that are configured to require certificates from the
1091 clients that connect to them. Normally a certificate is not
1092 required and this switch is optional.
1093
1094 --certificate-type=type
1095 Specify the type of the client certificate. Legal values are PEM
1096 (assumed by default) and DER, also known as ASN1.
1097
1098 --private-key=file
1099 Read the private key from file. This allows you to provide the
1100 private key in a file separate from the certificate.
1101
1102 --private-key-type=type
1103 Specify the type of the private key. Accepted values are PEM (the
1104 default) and DER.
1105
1106 --ca-certificate=file
1107 Use file as the file with the bundle of certificate authorities
1108 ("CA") to verify the peers. The certificates must be in PEM
1109 format.
1110
1111 Without this option Wget looks for CA certificates at the system-
1112 specified locations, chosen at OpenSSL installation time.
1113
1114 --ca-directory=directory
1115 Specifies directory containing CA certificates in PEM format. Each
1116 file contains one CA certificate, and the file name is based on a
1117 hash value derived from the certificate. This is achieved by
1118 processing a certificate directory with the "c_rehash" utility
1119 supplied with OpenSSL. Using --ca-directory is more efficient than
1120 --ca-certificate when many certificates are installed because it
1121 allows Wget to fetch certificates on demand.
1122
1123 Without this option Wget looks for CA certificates at the system-
1124 specified locations, chosen at OpenSSL installation time.
1125
1126 --random-file=file
1127 Use file as the source of random data for seeding the pseudo-random
1128 number generator on systems without /dev/random.
1129
1130 On such systems the SSL library needs an external source of
1131 randomness to initialize. Randomness may be provided by EGD (see
1132 --egd-file below) or read from an external source specified by the
1133 user. If this option is not specified, Wget looks for random data
1134 in $RANDFILE or, if that is unset, in $HOME/.rnd. If none of those
1135 are available, it is likely that SSL encryption will not be usable.
1136
1137 If you're getting the "Could not seed OpenSSL PRNG; disabling SSL."
1138 error, you should provide random data using some of the methods
1139 described above.
1140
1141 --egd-file=file
1142 Use file as the EGD socket. EGD stands for Entropy Gathering
1143 Daemon, a user-space program that collects data from various
1144 unpredictable system sources and makes it available to other
1145 programs that might need it. Encryption software, such as the SSL
1146 library, needs sources of non-repeating randomness to seed the
1147 random number generator used to produce cryptographically strong
1148 keys.
1149
1150 OpenSSL allows the user to specify his own source of entropy using
1151 the "RAND_FILE" environment variable. If this variable is unset,
1152 or if the specified file does not produce enough randomness,
1153 OpenSSL will read random data from EGD socket specified using this
1154 option.
1155
1156 If this option is not specified (and the equivalent startup command
1157 is not used), EGD is never contacted. EGD is not needed on modern
1158 Unix systems that support /dev/random.
1159
1160 FTP Options
1161 --ftp-user=user
1162 --ftp-password=password
1163 Specify the username user and password password on an FTP server.
1164 Without this, or the corresponding startup option, the password
1165 defaults to -wget@, normally used for anonymous FTP.
1166
1167 Another way to specify username and password is in the URL itself.
1168 Either method reveals your password to anyone who bothers to run
1169 "ps". To prevent the passwords from being seen, store them in
1170 .wgetrc or .netrc, and make sure to protect those files from other
1171 users with "chmod". If the passwords are really important, do not
1172 leave them lying in those files either---edit the files and delete
1173 them after Wget has started the download.
1174
1175 --no-remove-listing
1176 Don't remove the temporary .listing files generated by FTP
1177 retrievals. Normally, these files contain the raw directory
1178 listings received from FTP servers. Not removing them can be
1179 useful for debugging purposes, or when you want to be able to
1180 easily check on the contents of remote server directories (e.g. to
1181 verify that a mirror you're running is complete).
1182
1183 Note that even though Wget writes to a known filename for this
1184 file, this is not a security hole in the scenario of a user making
1185 .listing a symbolic link to /etc/passwd or something and asking
1186 "root" to run Wget in his or her directory. Depending on the
1187 options used, either Wget will refuse to write to .listing, making
1188 the globbing/recursion/time-stamping operation fail, or the
1189 symbolic link will be deleted and replaced with the actual .listing
1190 file, or the listing will be written to a .listing.number file.
1191
1192 Even though this situation isn't a problem, though, "root" should
1193 never run Wget in a non-trusted user's directory. A user could do
1194 something as simple as linking index.html to /etc/passwd and asking
1195 "root" to run Wget with -N or -r so the file will be overwritten.
1196
1197 --no-glob
1198 Turn off FTP globbing. Globbing refers to the use of shell-like
1199 special characters (wildcards), like *, ?, [ and ] to retrieve more
1200 than one file from the same directory at once, like:
1201
1202 wget ftp://gnjilux.srk.fer.hr/*.msg
1203
1204 By default, globbing will be turned on if the URL contains a
1205 globbing character. This option may be used to turn globbing on or
1206 off permanently.
1207
1208 You may have to quote the URL to protect it from being expanded by
1209 your shell. Globbing makes Wget look for a directory listing,
1210 which is system-specific. This is why it currently works only with
1211 Unix FTP servers (and the ones emulating Unix "ls" output).
1212
1213 --no-passive-ftp
1214 Disable the use of the passive FTP transfer mode. Passive FTP
1215 mandates that the client connect to the server to establish the
1216 data connection rather than the other way around.
1217
1218 If the machine is connected to the Internet directly, both passive
1219 and active FTP should work equally well. Behind most firewall and
1220 NAT configurations passive FTP has a better chance of working.
1221 However, in some rare firewall configurations, active FTP actually
1222 works when passive FTP doesn't. If you suspect this to be the
1223 case, use this option, or set "passive_ftp=off" in your init file.
1224
1225 --retr-symlinks
1226 By default, when retrieving FTP directories recursively and a
1227 symbolic link is encountered, the symbolic link is traversed and
1228 the pointed-to files are retrieved. Currently, Wget does not
1229 traverse symbolic links to directories to download them
1230 recursively, though this feature may be added in the future.
1231
1232 When --retr-symlinks=no is specified, the linked-to file is not
1233 downloaded. Instead, a matching symbolic link is created on the
1234 local filesystem. The pointed-to file will not be retrieved unless
1235 this recursive retrieval would have encountered it separately and
1236 downloaded it anyway. This option poses a security risk where a
1237 malicious FTP Server may cause Wget to write to files outside of
1238 the intended directories through a specially crafted .LISTING file.
1239
1240 Note that when retrieving a file (not a directory) because it was
1241 specified on the command-line, rather than because it was recursed
1242 to, this option has no effect. Symbolic links are always traversed
1243 in this case.
1244
1245 Recursive Retrieval Options
1246 -r
1247 --recursive
1248 Turn on recursive retrieving.
1249
1250 -l depth
1251 --level=depth
1252 Specify recursion maximum depth level depth. The default maximum
1253 depth is 5.
1254
1255 --delete-after
1256 This option tells Wget to delete every single file it downloads,
1257 after having done so. It is useful for pre-fetching popular pages
1258 through a proxy, e.g.:
1259
1260 wget -r -nd --delete-after http://whatever.com/~popular/page/
1261
1262 The -r option is to retrieve recursively, and -nd to not create
1263 directories.
1264
1265 Note that --delete-after deletes files on the local machine. It
1266 does not issue the DELE command to remote FTP sites, for instance.
1267 Also note that when --delete-after is specified, --convert-links is
1268 ignored, so .orig files are simply not created in the first place.
1269
1270 -k
1271 --convert-links
1272 After the download is complete, convert the links in the document
1273 to make them suitable for local viewing. This affects not only the
1274 visible hyperlinks, but any part of the document that links to
1275 external content, such as embedded images, links to style sheets,
1276 hyperlinks to non-HTML content, etc.
1277
1278 Each link will be changed in one of the two ways:
1279
1280 · The links to files that have been downloaded by Wget will be
1281 changed to refer to the file they point to as a relative link.
1282
1283 Example: if the downloaded file /foo/doc.html links to
1284 /bar/img.gif, also downloaded, then the link in doc.html will
1285 be modified to point to ../bar/img.gif. This kind of
1286 transformation works reliably for arbitrary combinations of
1287 directories.
1288
1289 · The links to files that have not been downloaded by Wget will
1290 be changed to include host name and absolute path of the
1291 location they point to.
1292
1293 Example: if the downloaded file /foo/doc.html links to
1294 /bar/img.gif (or to ../bar/img.gif), then the link in doc.html
1295 will be modified to point to http://hostname/bar/img.gif.
1296
1297 Because of this, local browsing works reliably: if a linked file
1298 was downloaded, the link will refer to its local name; if it was
1299 not downloaded, the link will refer to its full Internet address
1300 rather than presenting a broken link. The fact that the former
1301 links are converted to relative links ensures that you can move the
1302 downloaded hierarchy to another directory.
1303
1304 Note that only at the end of the download can Wget know which links
1305 have been downloaded. Because of that, the work done by -k will be
1306 performed at the end of all the downloads.
1307
1308 -K
1309 --backup-converted
1310 When converting a file, back up the original version with a .orig
1311 suffix. Affects the behavior of -N.
1312
1313 -m
1314 --mirror
1315 Turn on options suitable for mirroring. This option turns on
1316 recursion and time-stamping, sets infinite recursion depth and
1317 keeps FTP directory listings. It is currently equivalent to -r -N
1318 -l inf --no-remove-listing.
1319
1320 -p
1321 --page-requisites
1322 This option causes Wget to download all the files that are
1323 necessary to properly display a given HTML page. This includes
1324 such things as inlined images, sounds, and referenced stylesheets.
1325
1326 Ordinarily, when downloading a single HTML page, any requisite
1327 documents that may be needed to display it properly are not
1328 downloaded. Using -r together with -l can help, but since Wget
1329 does not ordinarily distinguish between external and inlined
1330 documents, one is generally left with "leaf documents" that are
1331 missing their requisites.
1332
1333 For instance, say document 1.html contains an "<IMG>" tag
1334 referencing 1.gif and an "<A>" tag pointing to external document
1335 2.html. Say that 2.html is similar but that its image is 2.gif and
1336 it links to 3.html. Say this continues up to some arbitrarily high
1337 number.
1338
1339 If one executes the command:
1340
1341 wget -r -l 2 http://<site>/1.html
1342
1343 then 1.html, 1.gif, 2.html, 2.gif, and 3.html will be downloaded.
1344 As you can see, 3.html is without its requisite 3.gif because Wget
1345 is simply counting the number of hops (up to 2) away from 1.html in
1346 order to determine where to stop the recursion. However, with this
1347 command:
1348
1349 wget -r -l 2 -p http://<site>/1.html
1350
1351 all the above files and 3.html's requisite 3.gif will be
1352 downloaded. Similarly,
1353
1354 wget -r -l 1 -p http://<site>/1.html
1355
1356 will cause 1.html, 1.gif, 2.html, and 2.gif to be downloaded. One
1357 might think that:
1358
1359 wget -r -l 0 -p http://<site>/1.html
1360
1361 would download just 1.html and 1.gif, but unfortunately this is not
1362 the case, because -l 0 is equivalent to -l inf---that is, infinite
1363 recursion. To download a single HTML page (or a handful of them,
1364 all specified on the command-line or in a -i URL input file) and
1365 its (or their) requisites, simply leave off -r and -l:
1366
1367 wget -p http://<site>/1.html
1368
1369 Note that Wget will behave as if -r had been specified, but only
1370 that single page and its requisites will be downloaded. Links from
1371 that page to external documents will not be followed. Actually, to
1372 download a single page and all its requisites (even if they exist
1373 on separate websites), and make sure the lot displays properly
1374 locally, this author likes to use a few options in addition to -p:
1375
1376 wget -E -H -k -K -p http://<site>/<document>
1377
1378 To finish off this topic, it's worth knowing that Wget's idea of an
1379 external document link is any URL specified in an "<A>" tag, an
1380 "<AREA>" tag, or a "<LINK>" tag other than "<LINK
1381 REL="stylesheet">".
1382
1383 --strict-comments
1384 Turn on strict parsing of HTML comments. The default is to
1385 terminate comments at the first occurrence of -->.
1386
1387 According to specifications, HTML comments are expressed as SGML
1388 declarations. Declaration is special markup that begins with <!
1389 and ends with >, such as <!DOCTYPE ...>, that may contain comments
1390 between a pair of -- delimiters. HTML comments are "empty
1391 declarations", SGML declarations without any non-comment text.
1392 Therefore, <!--foo--> is a valid comment, and so is <!--one--
1393 --two-->, but <!--1--2--> is not.
1394
1395 On the other hand, most HTML writers don't perceive comments as
1396 anything other than text delimited with <!-- and -->, which is not
1397 quite the same. For example, something like <!------------> works
1398 as a valid comment as long as the number of dashes is a multiple of
1399 four (!). If not, the comment technically lasts until the next --,
1400 which may be at the other end of the document. Because of this,
1401 many popular browsers completely ignore the specification and
1402 implement what users have come to expect: comments delimited with
1403 <!-- and -->.
1404
1405 Until version 1.9, Wget interpreted comments strictly, which
1406 resulted in missing links in many web pages that displayed fine in
1407 browsers, but had the misfortune of containing non-compliant
1408 comments. Beginning with version 1.9, Wget has joined the ranks of
1409 clients that implements "naive" comments, terminating each comment
1410 at the first occurrence of -->.
1411
1412 If, for whatever reason, you want strict comment parsing, use this
1413 option to turn it on.
1414
1415 Recursive Accept/Reject Options
1416 -A acclist --accept acclist
1417 -R rejlist --reject rejlist
1418 Specify comma-separated lists of file name suffixes or patterns to
1419 accept or reject. Note that if any of the wildcard characters, *,
1420 ?, [ or ], appear in an element of acclist or rejlist, it will be
1421 treated as a pattern, rather than a suffix.
1422
1423 -D domain-list
1424 --domains=domain-list
1425 Set domains to be followed. domain-list is a comma-separated list
1426 of domains. Note that it does not turn on -H.
1427
1428 --exclude-domains domain-list
1429 Specify the domains that are not to be followed..
1430
1431 --follow-ftp
1432 Follow FTP links from HTML documents. Without this option, Wget
1433 will ignore all the FTP links.
1434
1435 --follow-tags=list
1436 Wget has an internal table of HTML tag / attribute pairs that it
1437 considers when looking for linked documents during a recursive
1438 retrieval. If a user wants only a subset of those tags to be
1439 considered, however, he or she should be specify such tags in a
1440 comma-separated list with this option.
1441
1442 --ignore-tags=list
1443 This is the opposite of the --follow-tags option. To skip certain
1444 HTML tags when recursively looking for documents to download,
1445 specify them in a comma-separated list.
1446
1447 In the past, this option was the best bet for downloading a single
1448 page and its requisites, using a command-line like:
1449
1450 wget --ignore-tags=a,area -H -k -K -r http://<site>/<document>
1451
1452 However, the author of this option came across a page with tags
1453 like "<LINK REL="home" HREF="/">" and came to the realization that
1454 specifying tags to ignore was not enough. One can't just tell Wget
1455 to ignore "<LINK>", because then stylesheets will not be
1456 downloaded. Now the best bet for downloading a single page and its
1457 requisites is the dedicated --page-requisites option.
1458
1459 --ignore-case
1460 Ignore case when matching files and directories. This influences
1461 the behavior of -R, -A, -I, and -X options, as well as globbing
1462 implemented when downloading from FTP sites. For example, with
1463 this option, -A *.txt will match file1.txt, but also file2.TXT,
1464 file3.TxT, and so on.
1465
1466 -H
1467 --span-hosts
1468 Enable spanning across hosts when doing recursive retrieving.
1469
1470 -L
1471 --relative
1472 Follow relative links only. Useful for retrieving a specific home
1473 page without any distractions, not even those from the same hosts.
1474
1475 -I list
1476 --include-directories=list
1477 Specify a comma-separated list of directories you wish to follow
1478 when downloading. Elements of list may contain wildcards.
1479
1480 -X list
1481 --exclude-directories=list
1482 Specify a comma-separated list of directories you wish to exclude
1483 from download. Elements of list may contain wildcards.
1484
1485 -np
1486 --no-parent
1487 Do not ever ascend to the parent directory when retrieving
1488 recursively. This is a useful option, since it guarantees that
1489 only the files below a certain hierarchy will be downloaded.
1490
1492 Wget may return one of several error codes if it encounters problems.
1493
1494 0 No problems occurred.
1495
1496 1 Generic error code.
1497
1498 2 Parse error---for instance, when parsing command-line options, the
1499 .wgetrc or .netrc...
1500
1501 3 File I/O error.
1502
1503 4 Network failure.
1504
1505 5 SSL verification failure.
1506
1507 6 Username/password authentication failure.
1508
1509 7 Protocol errors.
1510
1511 8 Server issued an error response.
1512
1513 With the exceptions of 0 and 1, the lower-numbered exit codes take
1514 precedence over higher-numbered ones, when multiple types of errors are
1515 encountered.
1516
1517 In versions of Wget prior to 1.12, Wget's exit status tended to be
1518 unhelpful and inconsistent. Recursive downloads would virtually always
1519 return 0 (success), regardless of any issues encountered, and non-
1520 recursive fetches only returned the status corresponding to the most
1521 recently-attempted download.
1522
1524 /etc/wgetrc
1525 Default location of the global startup file.
1526
1527 .wgetrc
1528 User startup file.
1529
1531 You are welcome to submit bug reports via the GNU Wget bug tracker (see
1532 <http://wget.addictivecode.org/BugTracker>).
1533
1534 Before actually submitting a bug report, please try to follow a few
1535 simple guidelines.
1536
1537 1. Please try to ascertain that the behavior you see really is a bug.
1538 If Wget crashes, it's a bug. If Wget does not behave as
1539 documented, it's a bug. If things work strange, but you are not
1540 sure about the way they are supposed to work, it might well be a
1541 bug, but you might want to double-check the documentation and the
1542 mailing lists.
1543
1544 2. Try to repeat the bug in as simple circumstances as possible. E.g.
1545 if Wget crashes while downloading wget -rl0 -kKE -t5 --no-proxy
1546 http://yoyodyne.com -o /tmp/log, you should try to see if the crash
1547 is repeatable, and if will occur with a simpler set of options.
1548 You might even try to start the download at the page where the
1549 crash occurred to see if that page somehow triggered the crash.
1550
1551 Also, while I will probably be interested to know the contents of
1552 your .wgetrc file, just dumping it into the debug message is
1553 probably a bad idea. Instead, you should first try to see if the
1554 bug repeats with .wgetrc moved out of the way. Only if it turns
1555 out that .wgetrc settings affect the bug, mail me the relevant
1556 parts of the file.
1557
1558 3. Please start Wget with -d option and send us the resulting output
1559 (or relevant parts thereof). If Wget was compiled without debug
1560 support, recompile it---it is much easier to trace bugs with debug
1561 support on.
1562
1563 Note: please make sure to remove any potentially sensitive
1564 information from the debug log before sending it to the bug
1565 address. The "-d" won't go out of its way to collect sensitive
1566 information, but the log will contain a fairly complete transcript
1567 of Wget's communication with the server, which may include
1568 passwords and pieces of downloaded data. Since the bug address is
1569 publically archived, you may assume that all bug reports are
1570 visible to the public.
1571
1572 4. If Wget has crashed, try to run it in a debugger, e.g. "gdb `which
1573 wget` core" and type "where" to get the backtrace. This may not
1574 work if the system administrator has disabled core files, but it is
1575 safe to try.
1576
1578 This is not the complete manual for GNU Wget. For more complete
1579 information, including more detailed explanations of some of the
1580 options, and a number of commands available for use with .wgetrc files
1581 and the -e option, see the GNU Info entry for wget.
1582
1584 Originally written by Hrvoje Niksic <hniksic@xemacs.org>. Currently
1585 maintained by Micah Cowan <micah@cowan.name>.
1586
1588 Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
1589 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
1590
1591 Permission is granted to copy, distribute and/or modify this document
1592 under the terms of the GNU Free Documentation License, Version 1.2 or
1593 any later version published by the Free Software Foundation; with no
1594 Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
1595 copy of the license is included in the section entitled "GNU Free
1596 Documentation License".
1597
1598
1599
1600GNU Wget 1.12 2017-03-21 WGET(1)