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

    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

    That's what I do. Why the question? What are you thinking about? o_O
  3. Ocky

    Ocky Registered Member

    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 SL6 warnings
    rkhunter/Lucid rkhunter warnings
    rkhunter/rkhunter warnings recd.txt
    rkhunter/rkhunter script.mht
    [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

    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.

  5. Ocky

    Ocky Registered Member

    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 Global Moderator

    Removed Off Topic Post.
  8. NGRhodes

    NGRhodes Registered Member

    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

  10. Beavenburt

    Beavenburt Registered Member

    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.