Untar to a specific directory

Discussion in 'all things UNIX' started by Ocky, Apr 7, 2012.

Thread Status:
Not open for further replies.
  1. Ocky

    Ocky Registered Member

    Joined:
    May 6, 2006
    Posts:
    2,713
    Location:
    George, S.Africa
    How do you usually untar ? Say you saved a tar.gz to Desktop and now want to untar it to
    another directory, what is your usual method and do you use the command line ?

    I know how with the command line but it's a bit cumbersome.

    ( I think most folks simply r/click extract and then proceed to move the extracted folder to where they want it).
     
  2. vasa1

    vasa1 Registered Member

    Joined:
    May 1, 2010
    Posts:
    4,417
    That's what I do. Why the question? What are you thinking about? o_O
     
  3. Ocky

    Ocky Registered Member

    Joined:
    May 6, 2006
    Posts:
    2,713
    Location:
    George, S.Africa
    Just wondering who bothers with the command line for this. Surely we are both striving to become avid cli users ? :p
    Eg. [ocky@localhost General Help]$ tar -C /home/ocky/Desktop -xvzf "/home/ocky/Documents/General Help/rkhunter.tar.gz"
    rkhunter/
    rkhunter/rkhunter SL6 warnings
    rkhunter/README.txt
    rkhunter/Lucid rkhunter warnings
    rkhunter/rkhunter warnings recd.txt
    rkhunter/rkhunter script.mht
    rkhunter/rkhunter_scan.sh
    rkhunter/rkhunter.mht
    rkhunter/rkhunter
    [ocky@localhost General Help]$

    (for extracting rkhunter.tar.gz to Desktop)

    I didn't know this until recently i.e. was always stumped when trying to do it via the command line and thus noob depression set in. :)
     
  4. Mrkvonic

    Mrkvonic Linux Systems Expert

    Joined:
    May 9, 2005
    Posts:
    10,221
    tar zxvf <archive> -C <dir>

    I find this much more intuitive than the GUI.
    For gz, use xzvf.
    For bz2, use -xjvf.

    -v is optional.

    Cheers,
    Mrk
     
  5. Ocky

    Ocky Registered Member

    Joined:
    May 6, 2006
    Posts:
    2,713
    Location:
    George, S.Africa
    OK, thanks.
    ~ Removed Off Topic Comments ~
     
    Last edited by a moderator: Apr 8, 2012
  6. BrandiCandi

    BrandiCandi Guest

    Very useful to know- thanks!
     
  7. JRViejo

    JRViejo Super Moderator

    Joined:
    Jul 9, 2008
    Posts:
    97,885
    Location:
    U.S.A.
    Removed Off Topic Post.
     
  8. NGRhodes

    NGRhodes Registered Member

    Joined:
    Jun 23, 2003
    Posts:
    2,381
    Location:
    West Yorkshire, UK
    Open archive with fileroller (rather than right click/extract) and the use extract option which brings a dialog, part of which allows you choose a destination folder.

    If I happen to be in the command line I will extract my tarball from there.
     
  9. mack_guy911

    mack_guy911 Registered Member

    Joined:
    Mar 21, 2007
    Posts:
    2,677
  10. Beavenburt

    Beavenburt Registered Member

    Joined:
    Dec 17, 2006
    Posts:
    566
    Despite some linux nerds protestations there are particular functions that are more quickly carried out in gui rather than the command line. IMO extracting archives is one of them. Therefore I right click and "extract to"
     
Thread Status:
Not open for further replies.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.