#1
  1. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2004
    Posts
    597
    Rep Power
    15

    How to decompress .tar.bz2 file


    Hi folks,



    OpenBSD

    I have been googling around and could not figure out how to decompress .tar.bz2 file.

    # /bin/tar -xpjf filename.tar.bz2 --same-owner
    Code:
    tar: unknown option -- j
    usage: tar {crtux}[014578befHhLmOoPpqsvwXZz]
              [blocking-factor | archive | replstr] [-C directory] [-I file]
              [file ...]
           tar {-crtux} [-014578eHhLmOoPpqvwXZz] [-b blocking-factor]
              [-C directory] [-f archive] [-I file] [-s replstr] [file ...]
    # which bzip
    bzip: Command not found.
    # which bzip2
    bzip2: Command not found.
    # which bunzip
    bunzip: Command not found.

    I don't have them running on this box. Is there any solution. TIA

    B.R.
    satimis
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2006
    Posts
    859
    Rep Power
    388

    Cool



    bzip2 ships as standard on many Unix / Linux systems, you may want to check if it is already installed, or is present on the installation media --or-- go to the bzip2 web site for more info.

  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2004
    Posts
    597
    Rep Power
    15
    Hi LKBrwn_DBA.,

    Tks for your advice. This is a newly installed box

    bzip2 not installed
    # which bzip2
    bzip2: Command not found


    I only have OpenBSD 4.0 installer. Just mounted and read the CD, no packages found.

    Can I run CVS to install bzip2? If YES, please advise how to make it. TIA


    B.R.
    satimis
  6. #4
  7. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2006
    Posts
    859
    Rep Power
    388

    Cool



    "which bzip2" only looks in the directories from the PATH environment variable.

    Try looking somewhere else, maybe the following command will find it for you:

    find / -name 'bzip*'



    PS: CVS? I'm not familiar how you can install a package using CVS -- maybe it's an OpenBSD thing.

    In RedHat I would run the installation program and choose the software I want to install from a list from the CD.

  8. #5
  9. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,643
    Rep Power
    4248
    bzip2 is not installed by default on OpenBSD. You can either install it from ports or packages though. See http://www.openbsd.org/faq/faq15.html for details on installing from ports and packages.

    Also, the option j for tar only works for GNU tar, not for other tar versions (OpenBSD uses a BSD tar, which is closer to the original). Hence, you'll need to do the extraction in two stages:
    bzip2 -d file.tar.bz2
    tar xvf file.tar

    The other alternative would be to install GNU tar from ports or packages as well, and then you can type tar -jxvf
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2004
    Posts
    597
    Rep Power
    15
    Hi LKBrwn_DBA,


    "which bzip2" only looks in the directories from the PATH environment variable.

    Try looking somewhere else, maybe the following command will find it for you:

    find / -name 'bzip*'
    bzip an bzip2 not installed as default. Now I got bzip2 installed.


    PS: CVS? I'm not familiar how you can install a package using CVS -- maybe it's an OpenBSD thing.
    On OpenBSD "pkg_add" is for installing package. I just wonder whether CVS can do the job.

    In RedHat I would run the installation program and choose the software I want to install from a list from the CD.
    The OpenBSD 4.0 installer which I ran to install the OS has no packages on it. I have to download everything on Internet. Its total capacity is about 40MB

    satimis
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2004
    Posts
    597
    Rep Power
    15
    Hi Scorpions4ever,


    Tks for your advice and URL. I got bzip2 installed on Internet.

    # ls -l /usr/ports
    Code:
                                                        
           
    ls: /usr/ports: No such file or directory
    # find / -name ports
    No printout.

    I can't find "ports" here. Seemingly I miss something?


    Also, the option j for tar only works for GNU tar, not for other tar versions (OpenBSD uses a BSD tar, which is closer to the original).
    Not only missing j, also "--same-owner" option. I'm concerned the later.


    without "--same-owner" option the ownership of the file/directory after decompression is;
    Code:
    -rw-rw-r--  1 satimis  500   324098 Sep 12  2006 wingon_200505_200607063.pdf
    On GNU tar with "--same-owner" option the ownership of the file/directory after decompression is;
    Code:
    -rw-rw-r--  1 satimis  satimis   324098 Sep 12  2006 wingon_200505_200607063.pdf
    On /etc/group
    Code:
    satimis:*:500:
    I don't know whether there will be any difference between "satimis.satimis" and "satimis.500".

    Hence, you'll need to do the extraction in two stages:
    bzip2 -d file.tar.bz2
    tar xvf file.tar
    Tks. I can also do it on the fly;

    # bzip2 -d file.tar.bz2;tar xvf -

    OR

    # bzcat file.tar.bz2;tar xvf -

    I don't know the difference between "bzip2" abd "bzcat". Any idea? Tks.


    B.R.
    satimis
  14. #8
  15. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,643
    Rep Power
    4248
    Originally Posted by satimis
    I can't find "ports" here. Seemingly I miss something?
    The ports.tar.gz is on the CD (it is on Disk #3 on OpenBSD 4.0 CD set) and also available via ftp from openbsd sites or mirrors. All you need to do is:
    Code:
    $ cd /tmp
    $ ftp ftp://ftp.openbsd.org/pub/OpenBSD/4.0/ports.tar.gz
    $ cd /usr
    $ sudo tar xzf /tmp/ports.tar.gz
    In the above commands, substitute your own version # of OpenBSD instead of 4.0, depending on what you have installed.

    Originally Posted by satimis
    Not only missing j, also "--same-owner" option. I'm concerned the later.
    Sounds like you want GNU tar then. I have it installed on my OpenBSD boxes myself. Simply do the following:
    Code:
    export PKG_PATH=ftp://ftp.usa.openbsd.org/pub/OpenBSD/4.0/packages/sparc64
    pkg_add gtar-1.15.1p4-static
    Of course, you need to adjust your PKG_PATH according to your needs (I'm in the US, and I'm running this on a Sun Ultra 5). I usually put the export PKG_PATH statement in my ~/.profile file so that I don't need to type it each time. Also, if you simply type pkg_add gtar, it will tell you to be more specific, since there are two versions of gtar available (with or without -static). For other packages where there aren't multiple versions available, typing part of the package name is sufficient for the installer to figure out what to install.

    After you're done with the above command, you should have GNU tar installed in /usr/local/bin/gtar.


    Originally Posted by satimis
    Tks. I can also do it on the fly;

    # bzip2 -d file.tar.bz2;tar xvf -

    OR

    # bzcat file.tar.bz2;tar xvf -

    I don't know the difference between "bzip2" abd "bzcat". Any idea? Tks.
    Running bzcat is the same as running "bzip2 -dc". In fact, on my system, bzcat is symlinked to bzip2. Notionally, bzcat is supposed to only be used to decompress a file to stdout, whereas bzip2 can be used to compress or decompress files to any target. That's the general idea anyway
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo

IMN logo majestic logo threadwatch logo seochat tools logo