What is the correct way to curl to stdout, then untar (a zip file in that case) to a specific directory?

This failed:

curl URL | tar -x > /path

So I thought of this which also failed:

curl URL | tar -x > /path
  • Why would you untar a zip file rather than unzipping it? Or is it a gzip file containing a tar archive? gzip and zip are two different things.
    – DopeGhoti
    Jan 30, 2018 at 19:53
  • curl URL | unzip > /path fails. Jan 30, 2018 at 19:57
  • unzip cannot unzip from standard input, as stated in its manual page. You will have to write to a temporary file, unzip it, and delete the file.
    – DopeGhoti
    Jan 30, 2018 at 19:58
  • That's why I contemplated tar... It's not possible at all with tar? I really don't know. Jan 30, 2018 at 20:04
  • tar doesn't speak PKZip.
    – DopeGhoti
    Jan 30, 2018 at 20:06

1 Answer 1


Duplicate of How to redirect output of wget as input to unzip? (wget and curl are interchangeable in this context). Please see this answer. Replicating it here:

wget URL -O path/temp.zip; unzip -d path path/temp.zip; rm path/temp.zip

Replace URL and path accordingly.

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