How to Make Wget Output Verbose for Debugging

This article provides a quick overview of how to increase the verbosity of the wget command-line tool to troubleshoot and debug network connection or download issues. You will learn the specific flags required to reveal detailed request and response headers, how to log this data to an external file, and how to interpret the expanded output for effective troubleshooting.

Understanding Wget Verbosity Levels

By default, wget operates in a standard reporting mode, showing a basic progress bar, download speed, and essential HTTP status codes. When a download fails due to SSL/TLS handshake errors, authentication issues, or misconfigured server headers, this standard output lacks the depth needed for root-cause analysis.

wget offers built-in command-line options that alter its output behavior, ranging from completely silent to highly detailed debugging streams.

The Primary Verbose and Debug Flags

To get the most information out of wget, you can use two primary flags: --verbose (or -v) and --debug (or -d).

1. The Verbose Flag (-v or --verbose)

This is actually the default behavior for wget in many environments, but explicitly invoking it ensures that all available standard log information is printed to the screen. If wget has been configured to run quietly in a script, adding -v restores the full default reporting.

wget --verbose https://example.com/file.zip

2. The Debug Flag (-d or --debug)

For true debugging, the --debug flag is the most powerful tool. It displays full HTTP request and response headers, cookie exchanges, and detailed server interaction data.

Note: If your system’s version of wget was compiled without debug support, the -d flag will not work. Most standard Linux distributions (like Ubuntu, Debian, CentOS, and Fedora) include debug support by default.

wget -d https://example.com/file.zip

Combining Flags for Comprehensive Troubleshooting

When diagnosing complex network issues, combining the debug flag with other specific options allows you to pinpoint exactly where a transfer is failing.

View Server Headers Only

If you only want to inspect the HTTP headers sent by the server without downloading the actual file payload, combine the debug flag with the spider flag (--spider). This forces wget to act like a web scraper that checks file existence without saving it.

wget -d --spider https://example.com/file.zip

Saving Verbose Output to a Log File

Verbose and debug outputs can generate hundreds of lines of text, making them difficult to read in a standard terminal window. You can redirect this output to a dedicated log file using the -o or --output-file option.

wget -d -o wget_debug.log https://example.com/file.zip

Key Elements to Look For in Verbose Output

Once you generate a verbose log, focus on the following sections to resolve your issue: