wget -O is an option of the wget command used to specify the filename for saving the downloaded file. wget is a commonly used non-interactive network download tool that supports downloading files via HTTP, HTTPS, and FTP protocols.
When using wget to download files, by default, the downloaded file is saved with the filename specified in the URL. If you need to save the downloaded content with a different specified filename, you can use the -O option followed by the desired filename. Here, the 'O' must be uppercase.
Example
Suppose we need to download a webpage and save it as index.html, we can use the following command:
bashwget -O index.html http://example.com/
This command downloads the content of http://example.com/ and saves it as a local index.html file. Without using -O index.html, wget defaults to saving the file with the last segment of the URL as the filename, which may not be the desired filename in many cases.
This feature is very useful when you need to control the filename or path of the downloaded file, for example, when writing scripts to automatically download and specify the filename, enabling convenient subsequent processing and operations.