Use Wget Download the file to the Specified Name

Last Updated: Mon, July 25, 2022

Use of -O (or --output-document=file name)is not intended to mean simply "use the name file instead of the one in the URL"; rather, it is analogous to shell redirection: wget -O file URL is intended to work like wget -O - URL > file. The file will be truncated immediately, and all downloaded content will be written there. However, you can simply understand it as renaming the downloaded file.

wget -O vpsname.ico https://vpsname.com/favicon.ico
# same way
wget --output-document=vpsname.ico https://vpsname.com/favicon.ico

Download the file to the specified name

Well, when you execute this same command again, Wget will not add a number to the end of the file. Yes, the original file has been overwritten. You can run the command above as many times as you like and Wget will download the file and overwrite the existing one. If you run the command above without the -O option, Wget will create a new file each time you run it.

  • Attention should be paid to distinguishing the case of the letter O or o. You should use the capital "O" here.

If you interest in my articles, please consider buying me a coffee.

Write Your Comment