[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

Use the -O file option.


wget google.com
16:07:52 (538.47 MB/s) - `index.html' saved [10728]


wget -O foo.html google.com
16:08:00 (1.57 MB/s) - `foo.html' saved [10728]

Similar questions with download tag:

Similar questions with wget tag: