-2

I understand that *.tar.gz is a file, which is both archived(.tar) & compressed(.gz). I want to un-compress while retaining the archive. That is from *.tar.gz, I need to get *.tar.

When I execute tar zxf filename.tar.gz, the command un-compresses as well as extracts all the files within this archive. When I ignore the option x, the usage tar zf filename.tar.gz seems to be invalid.

tar: You must specify one of the -Acdtrux' or--test-label' options

Thanks in advance!

Swaroop
  • 1,219
  • 3
  • 16
  • 32
  • 1
    Just use gunzip? – Hellmar Becker Mar 09 '20 at 17:34
  • Questions about the Linux operating system and its utilities should be asked on https://unix.stackexchange.com/ Please delete this and ask over there. [What topics can I ask about here?](https://stackoverflow.com/help/on-topic) – Rob Mar 10 '20 at 10:08
  • @Rob how to migrate this question to unix.stackexchange.com? Deleting this question means all the answers provided here will be missing in unix.stackexchange.com – Swaroop Mar 10 '20 at 14:14
  • You can't migrate it and the people who answered your question should never have answered it since it's off topic. I'd also assume your question would get closed there, too, as a duplicate since it's a very common usage. – Rob Mar 10 '20 at 16:05

3 Answers3

2

Tar is for unpacking the archive, to just decompress use gzip

gzip -d filename.tar.gz
Krumelur
  • 31,081
  • 7
  • 77
  • 119
2

Or use

gunzip filename.tar.gz

which is a wrapper script for gzip -d.

Freddy
  • 4,548
  • 1
  • 7
  • 17
1

A ".tar.gz" file is simply a ".tar" file compressed with gzip compression (".gz"). It is an archive that supports multiple files, but no compression, inside another archive, which only provides compression!

As such, you can use gzip, a tool used to extract .gz files to get your tar file from your .tar.gz file. Use the decompression mode to decompress a file: gzip -d file.tar.gz, and you should get file.tar

id01
  • 1,491
  • 1
  • 14
  • 21