Go to the first, previous, next, last section, table of contents.


3.3 Advanced Options

The following table contains the alphabetically sorted list of the advanced command line arguments, for people familiar with basic operating of Wget, wishing to change its default behaviour. Not for the faint of heart.

`-A acclist --accept acclist'
`-R rejlist --reject rejlist'
Specify comma-separated lists of file name suffices or patterns to accept or reject. E.g., if you wish to download only GIFs or JPEGs, you can use `-A gif,jpg,jpeg'. If you wish to download everything except the cumbersome MPEGs and .AU files, you can use `-R mpg,mpeg,au'. If a string contains wildcards, it will be considered a globbing pattern, and will not be matched backwards. Thus you may specify `-A "*bjork*1995*html"' to accept only files containing `bjork' and `1995', ending with `html'. To download all files except the ones beginning with `bjork', use `wget -R "bjork*"'. The quotes are to prevent expansion by the shell.
`-c'
`--continue'
Continue retrieval of FTP documents, from where it was left off by another program or a previous instance of Wget. Thus you can write:
wget -c ftp://sunsite.doc.ic.ac.uk/ls-lR.Z
If there is a file name `ls-lR.Z' in the current directory, Wget will assume that it is the first portion of the remote file, and will require the server to continue the retrieval from an offset equal to the length of the local file. Note that you need not specify this option if all you want is Wget to continue retrieving where it left off when the connection is lost --- Wget does this by default. You need this option when you want to continue retrieval of a file already halfway retrieved, saved by another FTP client, or left by Wget being killed. Without `-c', the previous example would just begin to download the remote file to `ls-lR.Z.1'. `-c' option is also applicable for HTTP servers that support Range.
`-D domain-list'
`--domains=domain-list'
Set domains to be accepted and DNS looked-up, where `domain-list' is a comma-separated list. Note that it does not turn on `-H'. This option speeds things up, even if only one host is spanned (See section 6.3 Domain Acceptance).
`--delete-after'
This option tells Wget to delete every single file it downloads, after having done so. It is useful for pre-fetching popular pages through proxy, e.g.:
wget -r -nd --delete-after http://whatever.com/~popular/page/
`--dot-style=style'
Set the style of dot-traced retrieval. You can choose between several styles. With the default style each dot represents 1K, there are ten dots in a "cluster" and 50 dots in a line. binary style has a more "computer"-like orientation -- 8K dots, 16-dots clusters and 64 dots per line (which makes for 512K lines). mega style is suitable for downloading very large files -- each dot represents 64K retrieved, there are eight dots in a cluster, and 48 dots on each line (so each line contains 3M). micro style is exactly the reverse; it is suitable for downloading small files, with 128-byte dots, 8 dots per cluster, and 48 dots (6K) per line.
`-e command'
`--execute command'
Execute command as if it were a part of `.wgetrc' (See section 7 Startup File). A command thus invoked will take precedence over the same command in `.wgetrc'.
`-F'
`--force-html'
When input is read from a file, force it to be treated as an HTML file. This enables you to retrieve relative links from existing HTML files on your local disk, by adding `<base href>' to HTML, or using `--base'.
`-g on/off'
`--glob=on/off'
Turn FTP globbing on or off. Globbing means you may use the shell-like special characters (wildcards), like `*', `?', `[' and `]' to retrieve more than one file from the same directory at once, like:
wget ftp://gnjilux.cc.fer.hr/*.msg
By default, globbing will be turned on if the URL contains a globbing character. This option may be used to turn globbing on or off permanently. You may have to quote the URL to protect it from being expanded by your shell. Globbing makes Wget look for a directory listing, which is system-specific. This is why it currently works only with unix FTP servers (and the ones emulating unix ls output).
`--retr-symlinks'
Retrieve symbolic links on FTP sites as if they were plain files, i.e. don't just create links locally.
`-H'
`--span-hosts'
Enable spanning across hosts when doing recursive retrieving (See section 6.4 All Hosts).
`--header=additional-header'
Define an `additional-header' to be passed to the HTTP servers. Headers must contain a `:' preceded by one or more non-blank characters, and must not contain newlines. You may define more than one additional header by specifying `--header' more than once.
wget --header='Accept-Charset: iso-8859-2' \
     --header='Accept-Language: hr' \
       http://fly.cc.fer.hr/
Specification of an empty string as the header value will clear all the user-defined headers.
`--http-user=user'
`--http-passwd=password'
Specify the username `user' and password `password' on a HTTP server. Wget will "crypt" them using the basic (insecure) WWW authentication scheme. You can also encode the username and password to the URL (See section 4 URL Conventions).
`-I list'
`--include-directories=list'
Specify a comma-separated list of directories you wish to follow when downloading, the "opposite" of --exclude-directories. The directories are absolute paths. E.g. if you do want Wget to download/follow only things things from `/users' and `/cgi-bin', specify `-I /users,/cgi-bin' on the command line.
`-k'
`--convert-links'
Convert the non-relative links to relative ones locally.
`-L --relative'
Follow only relative links. Useful for retrieving a specific homepage without any distractions, not even those from the same hosts (See section 6.1 Relative Links).
`-m'
`--mirror'
Turn on options suitable for mirroring. This option turns on recursion and time-stamping, sets infinite recursion depth and keeps FTP directory listings. It is currently equivalent to `-r -N -l0 -nr'.
`-N'
`--timestamping'
Use the so-called time-stamps to determine whether to retrieve a file. If the last-modification date of the remote file is equal to, or older than that of local file, and the sizes of files are equal, the remote file will not be retrieved. This option is useful for weekly mirroring of HTTP or FTP sites, since it will not permit downloading of the same file twice.
`-nd'
Do not create a hierarchy of directories when retrieving recursively. With this option turned on, all files will get saved to the current directory, without clobbering (if a name shows up more than once, the filenames will get extensions `.n').
`-nH'
Disable generation of host-prefixed directories. By default, `wget -r http://fly.cc.fer.hr/' will create a structure of directories beginning with `fly.cc.fer.hr/'. This option disables it.
`-nh'
Disable the time-consuming DNS lookup of almost all hosts (See section 6.2 Host Checking).
`-np'
`--no-parent'
Do not ever ascend to the parent directory when retrieving recursively. This is a useful option, since it guarantees that only the files below a certain hierarchy will be downloaded. See section 6.5 No Parent for more details.
`-nr'
Do not remove the `.listing' files generated by FTP. This is useful when running a mirror to see the remote file list. It can also be used for debugging purposes.
`-nv'
Non-verbose output -- turn off verbose without being completely quiet (use `-q' for that), which means that error messages and basic information still get printed.
`-O file'
`--output-document=file'
The documents will not be written to the appropriate files, but all will be appended to a unique file specified by this option. The number of tries will be set to 1 automatically. If the `file' is `-', the documents will be written to stdout, and `--quiet' will be turned on. This option is useful for making Wget a part of pipelines (See section 8.2 Advanced Usage). Be careful, however, since setting `--quiet' turns off all the useful diagnostics Wget can otherwise give.
`-P prefix'
`--directory-prefix=prefix'
Set directory prefix (`.' by default) to `prefix'. The directory prefix is the directory where all other files and subdirectories will be saved to.
`-p'
`--prefix-files'
Set prefix files. By default, Wget will save URLs to appropriate file names (e.g. `http://yoyodine.com/sharon.gif' will be written to `sharon.gif'). With `-p' turned on, all the files will be saved to a single file. If a file with the same name already exists, the file name will be appended `.1'.
`-Q quota'
`--quota=quota'
Specify download quota for automatic retrievals. The value can be specified in bytes (default), kilobytes (with `k' suffix), or megabytes (with `m' suffix). Note that quota will never affect downloading a single file. So if you specify `wget -Q10k ftp://wuarchive.wustl.edu/ls-lR.gz', all of the `ls-lR.gz' will be downloaded. The same goes even when several URLs are specified on the command-line. However, quota is respected when retrieving either recursively, or from an input file. Thus you may safely type `wget -Q2m -i sites' -- download will be aborted when the quota is exceeded. Setting quota to 0 or `inf' unlimits the download quota.
`-S'
`--server-response'
Print the headers sent by HTTP servers and responses sent by FTP servers.
`-s'
`--save-headers'
Save the headers sent by the HTTP server to the file, before the actual contents.
`--spider'
When invoked with this option, Wget will behave as a Web spider, which means that it will not download the pages, just check that they are there. You can use it to check your bookmarks, e.g. with: (1)
wget --spider --force-html -i bookmarks.html
wget --spider -Fi **/*.html
`-T seconds'
`--timeout=seconds'
Set the read timeout to `seconds' seconds. Whenever a read is issued, the file descriptor is checked for a timeout, which could otherwise leave a pending connection (uninterrupted read). The default timeout is 900 seconds (fifteen minutes). Setting timeout to 0 will disable checking for timeouts.
`-X list'
`--exclude-directories=list'
Specify a comma-separated list of directories you wish to exclude from download. The directories are absolute paths. E.g. if you do not want Wget to download things from `/cgi-bin' directory, specify `-X /cgi-bin' on the command line. If you want to load all the files from `/pub' hierarchy except `/pub/emacs', specify `-I/pub -X/pub/emacs'.
`-x'
The opposite of `-nd' -- create a hierarchy of directories, even if one would not have been created otherwise.
`-Y on/off'
`--proxy=on/off'
Turn PROXY support on or off. The proxy is on by default if the appropriate environmental variable is defined.


Go to the first, previous, next, last section, table of contents.