Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
2 replies Latest Post - ‏2009-06-01T12:30:55Z by SystemAdmin
SystemAdmin
SystemAdmin
232 Posts
ACCEPTED ANSWER

Pinned topic gunzip -c file.tar.gz | tar -xvf -

‏2009-03-25T11:22:04Z |
gunzip -c file.tar.gz | tar -xvf -

why do we need to append "-" at the end to untar. If we take out "-" it throws error. Any explanation?
Updated on 2009-06-01T12:30:55Z at 2009-06-01T12:30:55Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    232 Posts
    ACCEPTED ANSWER

    Re: gunzip -c file.tar.gz | tar -xvf -

    ‏2009-03-26T09:57:19Z  in response to SystemAdmin
    The purpose is as follows

    -> We will expand the zip file, file.tar.gz & pass this file to the tar command & extract all the files from the expanded tar archive file
  • SystemAdmin
    SystemAdmin
    232 Posts
    ACCEPTED ANSWER

    Re: gunzip -c file.tar.gz | tar -xvf -

    ‏2009-06-01T12:30:55Z  in response to SystemAdmin
    > ddhar wrote:
    > gunzip -c file.tar.gz | tar -xvf -
    >
    > why do we need to append "-" at the end to untar. If we take out "-" it throws error. Any explanation?
    
    -c --stdout --to-stdout Write  output on standard output; keep original files unchanged.
    


    Gunzip command with "-c" will write the zip file out to the console. The "-" in the tar command signifies the console, hence the output of the gunzip command is taken as input to the tar command.