Commands.page Logo

wget Flag to Show URL After Redirects on Ubuntu

This article outlines the specific command-line flag required to display the final destination URL when using wget on Ubuntu. It provides a concise explanation of how to implement this option to ensure redirect chains are visible during the download process.

The flag that enables the detailed display of URLs, including those encountered after redirects, is --verbose. While wget follows redirects by default, using this flag ensures that every step of the redirection process is printed to the terminal output. This allows users to verify the actual final URL being accessed before the file download completes.

To use this flag, append --verbose or its shorthand -v to your wget command. For example, running wget --verbose https://example.com will output the initial request and any subsequent Redirecting to... messages showing the new location. This visibility is crucial for debugging download issues or verifying that a link leads to a trusted destination.

For even more detailed information, including the HTTP server response headers, you can combine --verbose with the --server-response flag. This combination displays the specific Location header sent by the server during the redirect. However, for most users needing to see the actual URL path after redirects, the --verbose flag alone is sufficient and keeps the output clean.