52

I'm downloading an engine game file which is compressed as .tar.bz2.

I'm trying this command

tar -zxvf enginsxt.tar.bz2

And it throws an error. I know that command

tar -zxvf

is only for extracting .tar.gz files, but how can I decompress this one?

WapDL
  • 531
  • 1
  • 4
  • 3
  • 5
    Possible duplicate of [How do I install a .tar.gz (or .tar.bz2) file?](http://askubuntu.com/questions/25961/how-do-i-install-a-tar-gz-or-tar-bz2-file) – David Dec 09 '15 at 18:05
  • 4
    `tar xf enginsxt.tar.bz2` works well enough with anything tar-related, you don't really need to specify the compression used anymore; welcome to the 21st century! – cylgalad Dec 10 '15 at 09:29
  • I tried [this](http://www.hostingadvice.com/how-to/untar-file-linuxubuntu/) and it worked. – Kulasangar Oct 13 '17 at 08:18

1 Answers1

82

Have you checked the man page for tar?

Here is the part that I extracted from man page of tar for bz2:

-j, --bzip2
          filter the archive through bzip2

Remove -z from your options and (optionally) add -j to extract your tar archive correctly:

tar -xvjf enginsxt.tar.bz2
Zanna
  • 69,223
  • 56
  • 216
  • 327
ostendali
  • 1,118
  • 6
  • 6
  • 5
    It still needs the `f` as the last option letter before the **f**ilename I think: either `xvjf ` or plain `xvf` (or even `xf` if you don't care about verbosity) since `tar` is smart enough to figure out the compression type... except when wrong-footed with an erroneous type, as the OP did. – steeldriver Dec 09 '15 at 19:53
  • that is right, kinda missed that, but he can figure that out from man page:-) – ostendali Dec 10 '15 at 09:25
  • Out of all letters, how did they arrive to `j`? – Neinstein Jul 22 '22 at 09:57