8

I'm using a Sun Sparc System, aka Solaris. I have a .tar.gz file, and I can't figure out how to untar it. The command I usually use doesn't work:

tar -xzvf file.tar.gz 

Anybody know how to do this? I can't be an answer anywhere!

fixer1234
  • 27,064
  • 61
  • 75
  • 116
  • 1
    Btw you should take note that "Solaris tar is sometimes broken (i.e. can't deal with long directory names etc.)". For more details see http://bytes.com/topic/python/answers/101777-python-installation-error-solaris-9-sparc#post364804 and http://www.python.org/download/releases/2.4.2/bugs/ – Cristian Ciupitu Sep 29 '09 at 15:50
  • The above comment "Solaris tar is sometimes broken" is wrong. The original Solaris tar only implements the original standardized tar file format. The "breakage" comes from GNU tar (and others) creating extensions to the tar file format without standardization. Saying "Solaris tar is broken" because it can't handle non-tar "tar" files is like saying `vi` is broken because it can't handle MS Word files. AIX tar can have the same issues with GNU "tar" archives: http://www-01.ibm.com/support/docview.wss?uid=swg21969357 – Andrew Henle Jan 30 '18 at 17:53

2 Answers2

14

You have to gunzip then untar on Solaris. It should come with GNU tar:

gtar xzvf somefile.tar.gz

if that doesn't work:

gunzip -c somefile.tar.gz |tar xvf -
John T
  • 163,373
  • 27
  • 341
  • 348
  • Doesn't the `z` option enable `gzip` anyway? – u1686_grawity Sep 29 '09 at 13:20
  • 1
    it should gunzip and untar in one. – John T Sep 29 '09 at 13:47
  • It does with GNU tar, but the tar that comes with Solaris is not GNU tar and doesn't support that option. – wfaulk Sep 29 '09 at 18:38
  • GNU tar comes with the freeware packages to install on Solaris – John T Sep 29 '09 at 20:42
  • 1
    You kids - you've been spoilt with those new-fangled GNU commands! (I tend to do "gzip -dc filename | tar tf -" as an automatic thing, whatever platform, even when it does have a gnu-tar available. After all, even if your tar understands gzip, it might not understand bzip2, 7za, etc...) – jrg Oct 07 '09 at 16:51
  • Solaris 11 & later tar support the `z` option for gzip, along with `Z` for compress and `j` for bzip2, but Solaris 10 and older do not support the compression options in the native tar, only in GNU tar. – alanc Dec 04 '12 at 07:11
0

For .bzip2 files I used the following procedure:

bunzip2 filename.tar.bz2

This will remove the bz2 extension.

Then

tar -xvf filename.tar

-v only for verbose mode.

alanc
  • 1,074
  • 6
  • 12
Tman
  • 71
  • 1
  • 4