How can I unzip a .tar.gz in one step (using 7-Zip)?

Not really. A .tar.gz or .tgz file really is two formats: .tar is the archive, and .gz is the compression. So the first step decompresses, and the second step extracts the archive.

To do it all in one step, you need the tar program. Cygwin includes this.

tar xzvf foobaz.tar.gz

; x = eXtract 
; z = filter through gZip
; v = be Verbose (show activity)
; f = filename

You could also do it "in one step" by opening the file in the 7-zip GUI: Open the .tar.gz file, double click the included .tar file, then extract those files to your location of choice.

There's a long running thread here of people asking/voting for one-step handling of tgz and bz2 files. The lack action thus far indicates it's not going to happen until someone steps and contributes meaningfully (code, money, something).


Old question, but I was struggling with it today so here's my 2c. The 7zip commandline tool "7z.exe" (I have v9.22 installed) can write to stdout and read from stdin so you can do without the intermediate tar file by using a pipe:

7z x "somename.tar.gz" -so | 7z x -aoa -si -ttar -o"somename"

Where:

x     = Extract with full paths command
-so   = write to stdout switch
-si   = read from stdin switch
-aoa  = Overwrite all existing files without prompt.
-ttar = Treat the stdin byte stream as a TAR file
-o    = output directory

See the help file (7-zip.chm) in the install directory for more info on the command line commands and switches.

You can create a context menu entry for .tar.gz/.tgz files that calls the above command using regedit or a 3rd party tool like stexbar.


Starting with 7-zip 9.04 there is a command-line option to do the combined extraction without using intermediate storage for the plain .tar file:

7z x -tgzip -so theinputfile.tgz | 7z x -si -ttar

-tgzip is needed if the input file is named .tgz instead of .tar.gz.

Tags:

Windows

Tar

7 Zip