WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: How can I extract non .tgz files, like tar.gz or tar.bz2, etc?  (Read 3964 times)

Offline leifanator

  • Newbie
  • *
  • Posts: 7
How can I extract non .tgz files, like tar.gz or tar.bz2, etc?
« on: October 21, 2010, 06:52:24 PM »
Most of the programs I want to use do not come in .tgz format.  How can I get an app that extracts these?
Is there a terminal command?

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: How can I extract non .tgz files, like tar.gz or tar.bz2, etc?
« Reply #1 on: October 21, 2010, 06:58:54 PM »
.tgz and .tar.gz are the same thing.

Code: [Select]
tar xvf file
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: How can I extract non .tgz files, like tar.gz or tar.bz2, etc?
« Reply #2 on: October 21, 2010, 09:32:58 PM »
To be a bit more verbose:
    tar option to extract: x
    tar option to produce verbose output (i.e. list file names): v
    tar option to (de)compress with gzip (for .tgz or .tar.gz files): z
    tar option to (de)compress with bzip2 (for .tar.bz2 files): j
    tar option to (de)compress with compress (for .tar.Z files): Z (but those file are now getting pretty rare)
    tar option to specify file name: f FILE (with '-' for FILE in case of stdin/out)

Please note that at least for older versions of 'GNU tar' to work with .tar.gz or .tar.bz2 files the 'z' or 'j' options had to be used. The 'BusyBox tar' (default in TC) "guesses" the archive file format and you get away (in most cases) with not using either of them. I personally stick with the (old) habit of always specifing 'z' or 'j', but YMMV.

Furthermore a 'tar' man page can be found here Be aware that it's for the 'GNU tar', but the subset of the parameters that BusyBox supports are also be found there.

Edit: Following Jasons remark (in reply #3) I've reworded my "warning" regarding the use of the 'z' and 'j' options.
« Last Edit: October 21, 2010, 11:24:53 PM by maro »

Offline Jason W

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 9730
Re: How can I extract non .tgz files, like tar.gz or tar.bz2, etc?
« Reply #3 on: October 21, 2010, 10:09:28 PM »
I have good results using "tar xvf" to untar any tgz, tar.gz, tar.bz2, and tar.xz files with GNU tar, I never use the J, j, or z switches nowadays.