difference between tar zxf vs -xvf

30,705

zxf means: gunzip (the 'z' letter) and extract (the 'x' letter) from file (the 'f' letter, and the file name follows).
xvf means: extract (the 'x' letter) and be verbose (the 'v' letter) from file (the 'f' letter, and the file name follows).

You renamed the openresty-1.9.7.3.tar to openresty-1.9.7.3.tar.gz, but this didn't made it gzipped tar archive. So first command fails, because this can't be gunzipped. Second command just verbosely extract the archive, without trying to gunzip it.

Share:
30,705
Scooby
Author by

Scooby

I exist because you think I do.

Updated on February 25, 2020

Comments

  • Scooby
    Scooby about 4 years

    I have a downloaded version of http://agentzh.org/misc/nginx/openresty-1.9.7.3.tar . I rename it to openresty-1.9.7.3.tar.gz.

    I am trying to do the following in centOS-6.x:

    tar zxf openresty-1.9.7.3.tar.gz
    gzip: stdin: not in gzip format
    tar: Child returned status 1
    tar: Error is not recoverable: exiting now
    

    whereas :

    tar -xvf openresty-1.9.7.3.tar.gz works and untars to openresty-1.9.7.3.tar.gz.

    Any reasons why the first one won't work? It works in my personal laptop but won't wont work in a server.