Commands.page Logo

How to Download File with Custom Name Using Wget Ubuntu

This article provides a concise guide on using the wget utility in Ubuntu to download files while specifying a custom filename. It covers the necessary command flags and syntax to ensure your downloaded content is saved exactly how you want it without requiring manual renaming after the transfer completes.

To download a file and save it with a custom name using wget, you need to use the -O flag. This option tells wget to write the downloaded content to a specific file instead of using the default name from the URL.

The basic syntax is as follows:

wget -O [custom_filename] [URL]

For example, if you want to download a file from https://example.com/archive.zip but save it locally as backup.zip, you would run:

wget -O backup.zip https://example.com/archive.zip

Replace backup.zip with your desired filename and the URL with the actual link to the file you wish to download. Be careful when using this command, as it will overwrite any existing file with the same name in the current directory without prompting for confirmation.