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?
NOTICE: 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.
This topic has been locked.
2 replies Latest Post - 2009-06-01T12:30:55Z by SystemAdmin
Pinned topic gunzip -c file.tar.gz | tar -xvf -
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2009-06-01T12:30:55Z at 2009-06-01T12:30:55Z by SystemAdmin
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.