[download] wget command to download a file and save as a different filename

I am downloading a file using the wget command. But when it downloads to my local machine, I want it to be saved as a different filename.

For example: I am downloading a file from www.examplesite.com/textfile.txt

I want to use wget to save the file textfile.txt on my local directory as newfile.txt. I am using the wget command as follows:

wget www.examplesite.com/textfile.txt

This question is related to download wget

The answer is

wget -O yourfilename.zip remote-storage.url/theirfilename.zip

will do the trick for you.


a) its a capital O.

b) wget -O filename url will only work. Putting -O last will not.

You would use the command Mechanical snail listed. Notice the uppercase O. Full command line to use could be:

wget www.examplesite.com/textfile.txt --output-document=newfile.txt


wget www.examplesite.com/textfile.txt -O newfile.txt

Hope that helps.

Using CentOS Linux I found that the easiest syntax would be:

wget "link" -O file.ext

where "link" is the web address you want to save and "file.ext" is the filename and extension of your choice.

Also notice the order of parameters on the command line. At least on some systems (e.g. CentOS 6):

wget -O FILE URL

works. But:

wget URL -O FILE

does not work.