Next: , Previous: URL Format, Up: Invoking



2.2 Option Syntax

Since Wget uses GNU getopt to process command-line arguments, every option has a long form along with the short one. Long options are more convenient to remember, but take time to type. You may freely mix different option styles, or specify options after the command-line arguments. Thus you may write:

     wget -r --tries=10 http://fly.srk.fer.hr/ -o log

The space between the option accepting an argument and the argument may be omitted. Instead -o log you can write -olog.

You may put several options that do not require arguments together, like:

     wget -drc URL

This is a complete equivalent of:

     wget -d -r -c URL

Since the options can be specified after the arguments, you may terminate them with --. So the following will try to download url -x, reporting failure to log:

     wget -o log -- -x

The options that accept comma-separated lists all respect the convention that specifying an empty list clears its value. This can be useful to clear the .wgetrc settings. For instance, if your .wgetrc sets exclude_directories to /cgi-bin, the following example will first reset it, and then set it to exclude /~nobody and /~somebody. You can also clear the lists in .wgetrc (see Wgetrc Syntax).

     wget -X '' -X /~nobody,/~somebody

Most options that do not accept arguments are boolean options, so named because their state can be captured with a yes-or-no (“boolean”) variable. For example, --follow-ftp tells Wget to follow FTP links from HTML files and, on the other hand, --no-glob tells it not to perform file globbing on FTP URLs. A boolean option is either affirmative or negative (beginning with --no). All such options share several properties.

Unless stated otherwise, it is assumed that the default behavior is the opposite of what the option accomplishes. For example, the documented existence of --follow-ftp assumes that the default is to not follow FTP links from HTML pages.

Affirmative options can be negated by prepending the --no- to the option name; negative options can be negated by omitting the --no- prefix. This might seem superfluous—if the default for an affirmative option is to not do something, then why provide a way to explicitly turn it off? But the startup file may in fact change the default. For instance, using follow_ftp = off in .wgetrc makes Wget not follow FTP links by default, and using --no-follow-ftp is the only way to restore the factory default from the command line.