Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
ok here is what i want to do i want to extract a tar.bz2 to a certain directory using the shell i dont know the command cuz im new...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User gassman's Avatar
    Join Date
    Jan 2005
    Location
    Midwest USA
    Posts
    292

    extract .tar.bz2 command


    ok here is what i want to do i want to extract a tar.bz2 to a certain directory using the shell i dont know the command cuz im new
    If we couldn't laugh we would all go insane--Jimmy Buffett


    Registered Linux user # 376962

  2. #2
    Linux Guru
    Join Date
    Mar 2003
    Location
    Wisconsin
    Posts
    1,907
    To extract a tar.bz2 file, use the command (note the j option)

    Code:
    tar -jxvf filename.tar.bz2
    To extract a tar.gz file, the the command (note the z option)

    Code:
    tar -zxvf filename.tar.gz
    Jeremy
    Registered Linux user #346571
    "All The Dude ever wanted was his rug back" - The Dude

  3. #3
    Linux User gassman's Avatar
    Join Date
    Jan 2005
    Location
    Midwest USA
    Posts
    292
    but what if i want to extract it to a certain directory like :/usr/local/lib
    If we couldn't laugh we would all go insane--Jimmy Buffett


    Registered Linux user # 376962

  4. #4
    Linux Guru
    Join Date
    Mar 2003
    Location
    Wisconsin
    Posts
    1,907
    Move the file to that directory and untar it.

    Jeremy
    Registered Linux user #346571
    "All The Dude ever wanted was his rug back" - The Dude

  5. #5
    Linux Engineer
    Join Date
    Nov 2004
    Location
    home
    Posts
    796
    Depending on what version of tar you have, it might need the y or I option instead of j. Though they seem to have stuck with j in all the newer releases.

  6. #6
    Linux Enthusiast
    Join Date
    Jun 2004
    Location
    Windsor, CO
    Posts
    656
    The simplest way to extract to a specific directory:
    For a .tar.gz:
    Code:
    tar -xvzf file.tar.gz -C directory
    For a .tar.bz2:
    Code:
    tar -xvjf file.tar.bz2 -C directory
    And it's case sensitive, so make sure you use -C and not -c[/i]
    Emotions are the key to the soul.
    Registered Linux User #375050

  7. #7
    Linux User gassman's Avatar
    Join Date
    Jan 2005
    Location
    Midwest USA
    Posts
    292
    thanx stormblazer
    If we couldn't laugh we would all go insane--Jimmy Buffett


    Registered Linux user # 376962

  8. #8
    Just Joined!
    Join Date
    Jan 2005
    Posts
    15
    ANother easy way (and the method I always use) to have it extract to a directory:

    untar/zip it to get the folder, then use

    mv [foldername] [destination]

    for example

    mv firefox-installer /opt

  9. #9
    Linux Engineer
    Join Date
    May 2003
    Location
    Greece / Athens
    Posts
    1,169
    there are to many ways to do that!!
    Linux For Ever!

  10. #10
    Just Joined!
    Join Date
    Jan 2005
    Posts
    15
    ONe of the beautiful things about Linux is that there are a dozen ways to do anything, and you can find the way that works with your mind best.

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •