-1

I cannot seem to find out how to install a tar.bz2 file. I've Googled it and I've came across two commands, these did not work. I've changed my directory to my downloads folder cd ~downloads after that I've tried these two

tar -xjvf Sublime Text 2.0.2 x64.tar.bz2 

tar -zxvf Sublime Text 2.0.2 x64.tar.bz2

and they both gave me the error of

tar (child): Sublime: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now

I couldn't have spelled it wrong, as I copied the name directly from the archive. I'm very new to Linux, so can someone tell me what I'm doing wrong?

  • Try to use tab to complete feature, i.e. press tab after partially entering a filename. Check with file command to verify if it's indeed a tar.bz2. – SparKot Feb 27 '14 at 6:23
  • @SparKotॐ I typed in tar -zxvf Sublime and pressed tab and didn't work... – ErraticFox Feb 27 '14 at 6:26
  • What is the exact name of the file you got from the archive? – Anthon Feb 27 '14 at 6:38
  • @Anthon Sublime Text 2.0.2 x64 – ErraticFox Feb 27 '14 at 6:42
  • I searched for it and the name of the archive is "Sublime Text 2.0.2 x64.tar.bz2" so what is the name you copied directly from this archive? – Anthon Feb 27 '14 at 6:50
3

The error message you're getting is a result of not being able to unzip the file "Sublime".

tar (child): Sublime: Cannot open: No such file or directory

This is because the filename argument being passed to tar is everything up to the first space, Sublime Text.... You can wrap it in double quotes so that the shell, Bash, knows you intend to pass the entire string as a filename to tar.

$ tar -jxvf "Sublime Text 2.0.2 x64.tar.bz2"

Other problems?

1. File type

Often times when I download files such as these I like to use the file command on them to confirm that they're in fact named correctly.

Examples

$ file /home/saml/gaffiter.bz2
/home/saml/gaffiter.bz2: bzip2 compressed data, block size = 900k

$ file /etc/ntop/oui.txt.gz
/etc/ntop/oui.txt.gz: gzip compressed data, was "oui.txt", from Unix, last modified: Sun May  6 00:30:01 2012

$ file /home/saml/Downloads/lplinux.tar.bz2
/home/saml/Downloads/lplinux.tar.bz2: bzip2 compressed data, block size = 900k
2. Corrupt download?

Try re-downloading the file. I just downloaded it and it unpacked just fine.

$ wget http://c758482.r82.cf2.rackcdn.com/Sublime\ Text\ 2.0.2.tar.bz2

$ file "Sublime Text 2.0.2.tar.bz2"
Sublime Text 2.0.2.tar.bz2: bzip2 compressed data, block size = 900k

$ tar jxvf "Sublime Text 2.0.2.tar.bz2"
Sublime Text 2/
Sublime Text 2/Pristine Packages/
Sublime Text 2/Pristine Packages/Lisp.sublime-package
Sublime Text 2/Pristine Packages/TCL.sublime-package
Sublime Text 2/Pristine Packages/Text.sublime-package
...
1

You first have to specify the name of the archive, then the name(s) of the file you want to extract from it. If that name has spaces, you have to quote them. The filename ending in .tar.bz2 is the archive.

As I can't know the name you are trying to extract try the following:

tar -xjvf  x64.tar.bz2 "Sublime Text 2.0.2"

or

tar -xjvf  "2.0.2 x64.tar.bz2" "Sublime Text"

or

tar -xjvf  "Text 2.0.2 x64.tar.bz2" Sublime
  • None of those worked. You can download the package via their website (which has to be pretty obvious on how to find it). – ErraticFox Feb 27 '14 at 6:43
  • You might not now the terminology but "Sublime Text 2.0.2 x64.tar.bz2" is the archive not a name you copied from the archive, that was misleading. – Anthon Feb 27 '14 at 6:51
  • Then how do I know what's the archive name? – ErraticFox Feb 27 '14 at 7:04
  • A file ending in .tar is normally the archive. A file ending in .tar.bz2 is normally a compressed arvhive. The name of this arvhive is "Sublime Text 2.0.2 x64.tar.bz2" (the quotes are not part of the name but necessary to show these are not 4 filenames, but just one). The archive also has the names of the files in it. In this case you are extracting all files, you don't need to copy a name from the archive. – Anthon Feb 27 '14 at 7:50
  • So what do I put? – ErraticFox Feb 27 '14 at 8:09
0

tar -xjvf "Sublime Text 2.0.2 x64.tar.bz2"

Quotes are required because there are spaces in the filename.

  • I received the same error after applying the quotes. – ErraticFox Feb 27 '14 at 6:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.