Open In App

Linux – Renaming File While Downloading with Wget

Improve
Improve
Like Article
Like
Save
Share
Report

Wget utility is the most popular and powerful tool to download files on operating systems like Linux and Windows OS.Wget supports the HTTP, HTTPS, and FTP protocols, as well as retrieval through HTTP proxies.

Wget is non-interactive, which means it can work in the background while the user is not logged on. In case while downloading any file if the downloading disturbs then the wget save the half downloaded file and allow us to download the remaining part of the file to download. Wget also provides the feature of downloading websites to use offline.

By default, the wget downloads the file and saves it with the original name in the URL. Let’s see what options provide the wget. To see all options of wget use the following command

wget --help

Then wget shows the all options to how to use it.

Wget help (How to Rename File While Downloading with Wget in Linux)

Now let’s see how to download the file using wget. 

To download the file using wget use the following command:

wget -c FILE_URL

Here we have used -c option because it allows users to complete the partially downloaded files. Here is example 

How to Rename File While Downloading with Wget in Linux

In the above image, we can see that the file is downloaded with the name of the file in the URL. Now let’s see how to rename file while downloading

Wget provide the -O option to save the file with a different name instate of the name in the URL. Use the following command to save the downloaded file with a different name.

 wget  -cO   - FILE_URL > NEW_FILE_NAME.extension

In the above command instead of FILE_URL use the URL of the file to be downloaded and in the place of NEW_FILE_NAME.extension use the new name to file with the extension. Here is example

How to Rename File While Downloading with Wget in Linux

The file is written to standard output and then redirected by the shell to the specified file as shown in the screenshot above.


Last Updated : 11 Feb, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads