Find the answer to your Linux question:
Results 1 to 9 of 9
I can not find the piece of paper that I wrote this command down on so I have to ask for it again, sorry!! ( my mind is shrinking every ...
  1. #1
    Linux Enthusiast cousinlucky's Avatar
    Join Date
    Dec 2005
    Location
    New York City
    Posts
    575

    What is the terminal command for tar.Bz2 files, please?

    I can not find the piece of paper that I wrote this command down on so I have to ask for it again, sorry!! ( my mind is shrinking every day )

    I am using ubuntu 8.04! Thanks!
    Linux registered user # 414321
    You Should Not Give In To Evils, But Proceed Ever More Boldly Against Them!! -from book six of Virgil's Aeneid
    http://www.paynal.com
    Everything Within The Universe Is Related; We Are All Cousins!!

  2. #2
    Linux Guru
    Join Date
    Mar 2003
    Location
    Wisconsin
    Posts
    1,907
    It should be

    tar -xjvf file.bz2
    The option is:

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

  3. #3
    Linux Enthusiast cousinlucky's Avatar
    Join Date
    Dec 2005
    Location
    New York City
    Posts
    575
    Thanks Jeremy!! I need to look for an uncomplicated book that contains terminal commands that I can keep right next to my desktop computer!! Thanks Again!!!
    Linux registered user # 414321
    You Should Not Give In To Evils, But Proceed Ever More Boldly Against Them!! -from book six of Virgil's Aeneid
    http://www.paynal.com
    Everything Within The Universe Is Related; We Are All Cousins!!

  4. #4
    Linux Guru
    Join Date
    Mar 2003
    Location
    Wisconsin
    Posts
    1,907
    Linux in a Nutshell comes highly recommended.

    Linux in a Nutshell, Fifth Edition - O'Reilly Media
    Registered Linux user #346571
    "All The Dude ever wanted was his rug back" - The Dude

  5. #5
    Linux Guru reed9's Avatar
    Join Date
    Feb 2009
    Location
    Boston, MA
    Posts
    4,651
    Another handy thing is to cheat and utilize other people's hard work.

    Put this is the file ~/.bashrc
    Code:
    extract () {
        if [[ -f $1 ]] ; then
            case $1 in
                *.tar.bz2)  bzip2 -v -d $1      ;;
                *.tar.gz)   tar -xvzf $1        ;;
                *.rar)      unrar e $1          ;;
                *.deb)      ar -x $1            ;;
                *.bz2)      bzip2 -d $1         ;;
                *.lzh)      lha x $1            ;;
                *.gz)       gunzip -d $1        ;;
                *.tar)      tar -xvf $1         ;;
                *.tgz)      gunzip -d $1        ;;
                *.tbz2)     tar -jxvf $1        ;;
                *.zip)      unzip $1            ;;
                *.Z)        uncompress $1       ;;
                *)          echo "'$1' Error. Please go away" ;;
            esac
        else
            echo "'$1' is not a valid file"
        fi
    }
    Source that file and now when you can just type
    Code:
    extract filename.zip
    Or filename.tar.bz2 or tar.gz or whatever. (You do need all the correct programs installed, unrar, unzip, etc.)

  6. #6
    Linux Enthusiast cousinlucky's Avatar
    Join Date
    Dec 2005
    Location
    New York City
    Posts
    575
    Quote Originally Posted by reed9 View Post
    Another handy thing is to cheat and utilize other people's hard work.

    Put this is the file ~/.bashrc
    Code:
    extract () {
        if [[ -f $1 ]] ; then
            case $1 in
                *.tar.bz2)  bzip2 -v -d $1      ;;
                *.tar.gz)   tar -xvzf $1        ;;
                *.rar)      unrar e $1          ;;
                *.deb)      ar -x $1            ;;
                *.bz2)      bzip2 -d $1         ;;
                *.lzh)      lha x $1            ;;
                *.gz)       gunzip -d $1        ;;
                *.tar)      tar -xvf $1         ;;
                *.tgz)      gunzip -d $1        ;;
                *.tbz2)     tar -jxvf $1        ;;
                *.zip)      unzip $1            ;;
                *.Z)        uncompress $1       ;;
                *)          echo "'$1' Error. Please go away" ;;
            esac
        else
            echo "'$1' is not a valid file"
        fi
    }
    Source that file and now when you can just type
    Code:
    extract filename.zip
    Or filename.tar.bz2 or tar.gz or whatever. (You do need all the correct programs installed, unrar, unzip, etc.)
    Reed I am guessing that you suggest that I copy and paste this into the ~/.bashrc file but I do not have any idea on how to access that file. Which file folder is it in, please?

    What do you mean by " source that file " ?

    Thanks!!
    Linux registered user # 414321
    You Should Not Give In To Evils, But Proceed Ever More Boldly Against Them!! -from book six of Virgil's Aeneid
    http://www.paynal.com
    Everything Within The Universe Is Related; We Are All Cousins!!

  7. #7
    Linux Guru reed9's Avatar
    Join Date
    Feb 2009
    Location
    Boston, MA
    Posts
    4,651
    ~ is a shortcut for /home/user/

    Just open with any text editor.

    Code:
    gedit ~/.bashrc
    The changes don't take effect immediately, but you can source the configuration file in the current session, thereby utilizing the changes
    Code:
    source ~/.bashrc
    Or of course restart the session.

  8. #8
    Linux Enthusiast cousinlucky's Avatar
    Join Date
    Dec 2005
    Location
    New York City
    Posts
    575
    Thank You Reed9!! I was born in Boston many moons ago. Everyone says it has changed dramatically after rent control ended in 1997 or 1998!
    Linux registered user # 414321
    You Should Not Give In To Evils, But Proceed Ever More Boldly Against Them!! -from book six of Virgil's Aeneid
    http://www.paynal.com
    Everything Within The Universe Is Related; We Are All Cousins!!

  9. #9
    Linux Guru reed9's Avatar
    Join Date
    Feb 2009
    Location
    Boston, MA
    Posts
    4,651
    No problem. I found it somewhere on the Arch forums initially and it seemed a handy idea.

    You can change the name to whatever you like too. So the beginning part could be different, shortened if you want so say from this
    Code:
    extract () {
    to this
    Code:
    ex () {
    And then would you just type ex filename.tar.gz

    As for Boston, I was born and raised in Seattle. Been here for just over a year, so I couldn't comment on the changes.

Posting Permissions

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