I'm using bash on Amazon Linux.

When I visit the following URL in a browser, https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US, I get a file, firefox-56.0.1.tar.bz2. However, when I use wget, the file that downloasd has an "index.html" in the title, even though it looks like the same file. So I tried

wget -r --no-parent --reject "index.html*" -nH --cut-dirs=7 "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US"

but now no file gets downloaded. How can I download the file using wget (or some other command line tool) and get the file to be titled the same way it is when I visit that URL in a browser?

3 Answers 3


In this case, you want to trust the server name being sent in the headers, without that directive wget will use the file name in the URL...

wget "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US" --trust-server-names

Of course, for that to work, all servers need to send a file name for whatever file is being sent/generated. Some scripts don't do this - if that is the case, you'll still get "index.html" that is actually the file.

What you do in that case is use the -O output option, and specify the desired filename on your end

wget "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US" -O latest-firefox.tar.bz2

Of course you need to know what file type it is, etc. for this part to work.


You can install cliget addon for firefox. After pressing on the link it will generate a curl command under Download with cURL. In this case it would be something like this:

curl --header 'Host: ftp.mozilla.org' --header 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0' --header 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' --header 'Accept-Language: en,de;q=0.5' --header 'Cookie: optimizelyEndUserId=oeu1495381484085r0.16482844406273445; optimizelySegments=%7B%22245984388%22%3A%22false%22%2C%22246002457%22%3A%22search%22%2C%22246073289%22%3A%22none%22%2C%22246073290%22%3A%22ff%22%7D; optimizelyBuckets=%7B%7D' --header 'DNT: 1' --header 'Connection: keep-alive' --header 'Upgrade-Insecure-Requests: 1' 'https://ftp.mozilla.org/pub/firefox/releases/56.0.1/linux-x86_64/en-US/firefox-56.0.1.tar.bz2' -o 'firefox-56.0.1.tar.bz2' -L

  • Thanks. Here you are hard-coding "firefox-56.0.1.tar.bz2". Why, when I download the file in a browser does it get a different file name ("firefox-56.0.1.tar.bz2") then when I use wget?
    – Dave
    Commented Oct 18, 2017 at 16:40
  • I don't hardcode it, cliget created that command. Another user has already posted an answer for your question. Commented Oct 18, 2017 at 16:44

Simply with curl tool:

curl -Os "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US/firefox-56.0.1.tar.bz2" 

-O, --remote-name
Write output to a local file named like the remote file we get. (Only the file part of the remote file is used, the path is cut off.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .