I am trying to download a file hpraid.tar.gz from a remote server using

wget --no-check-certificate http://xx.xx.xx/hpraid.tar

curl -O http://xx.xx.xx/hpraid.tar

Even though the .gz extension is omitted in the filename part, yet the file gets downloaded by both wget and curl This partial filename match without any wildcard baffles me.

Is there anyway I can force wget and curl to match the complete filename?

  • Is the file that you get through those commands compressed or not? I know that some FTP servers are able to generate archives and compressed archives of directories when accessed with a directory name ending in either .tar or .tar.gz, and the HTTP server that you're accessing may do something similar. (just speculation).
    – Kusalananda
    Jul 9, 2018 at 12:33
  • curl -o hpraid.tar.gz http://xx.xx.xx/hpraid.tar
    – pLumo
    Jul 9, 2018 at 13:12
  • @RoVo, I would need the exact file(name) in the server to be downloaded (i.e) hpraid.tar.gz without any short name. Nothing more and nothing less otherwise my automation script would fail. Jul 9, 2018 at 13:35
  • Then why not curl -O http://xx.xx.xx/hpraid.tar.gz ? I somehow feel like this an XY Problem.
    – pLumo
    Jul 9, 2018 at 13:40
  • 2
    IMHO, it is not a client decision. It'd be the server that serves the file on incomplete request too. Can you try curl -v -O http://xx.xx.xx/hpraid.tar and show us the standard output?
    – andcoz
    Jul 9, 2018 at 14:16

1 Answer 1


You can use curl -v telnet://xx.xx.xx:80/ and test if the server is the one expanding hpraid.tar to hpraid.tar.gz.


The following illustrates how we can use curl interactively. Here we're requesting the following URL directly from the server GET /.

$ curl -svLI telnet://www.google.com:80/ <<< "GET /" | head -5
*   Trying
* Connected to www.google.com ( port 80 (#0)
HTTP/1.0 200 OK
Date: Mon, 09 Jul 2018 19:39:10 GMT
Expires: -1

NOTE: Above we can see that we sent a GET / to Google and it responded with a STATUS 200.

Your issue

To verify that the server is doing the addition of the file extension .gz you can do something like this to verify it yourself:

$ curl -v telnet://xx.xx.xx.xx/hbraid.tar <<< "GET /"

If you see your file downloading then you know that the server is doing the appending. If it fails, then you know it's the client doing it (curl or wget).


If you run into any issues with the above, you can do this all manually like so:

  1. curl server's HTTP port

    $ curl -svLI telnet://www.google.com:80/
    *   Trying
    * Connected to www.google.com ( port 80 (#0)
  2. Get URL

    GET / <--- hit Return after this 2 times!
  3. Visually verify download

Additional tools

You can do something similar using socat or nc as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.