Find the answer to your Linux question:
Results 1 to 7 of 7
hey, i know that a file with .tar.gz suffix can be unzipped by using the command: tar -zxvf <filename>.tar.gz but what about files with .tar sequence or .gz alone they ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    Nov 2003
    Location
    Syria
    Posts
    181

    .gz unzipping command


    hey,
    i know that a file with .tar.gz suffix can be unzipped by using the command:
    tar -zxvf <filename>.tar.gz
    but what about files with .tar sequence or .gz alone they won't accept that command, what should i use for them?

    XT
    Registered Linux User # 368300 at Linux Counter

  2. #2
    Linux Newbie
    Join Date
    May 2004
    Location
    Boston, MA
    Posts
    246
    Despite how vaguely wrong it sounds, I recommend you type "man tar" at the command prompt and read the manpage. The options you currently use do the following:

    x: Extract. This option extracts an archive, as opposed to c, which creates one, or t, which tests one (e.g. tar tvf file.tar) would list all the files in file.tar.

    v: Verbose. This causes tar to list all the files that it's creating. You can also use vv ("very verbose"), to list lots of information about the files.

    z: Gzip. This passes the file through a gzip filter, so it extracts .tar .gz files.

    f: Which specifies that the next item on the command line is the file to be used.

    Therefore, to extract regular ,tar files, use
    Code:
    tar xvf file.tar
    There's a separate command, gunzip that's used to extract regular .gz files. Type "man gunzip" at the command prompt for it's manpage. Basically, you can just say
    Code:
    gunzip file.gz
    Good luck.
    Situations arise because of the weather,
    And no kinds of love are better than others.

  3. #3
    dt2
    dt2 is offline
    Just Joined!
    Join Date
    Jun 2004
    Location
    UK
    Posts
    88
    That's the best (and more thorough) answer I've seen on that topic! Many thanks.

    Question: any particular need for the "-" before the parameters? e.g. tar xfv file.tar versus tar -xfv file.tar

    Also note that if the file was zipped in Windows (evil! yuck! gross!) you can unzip it with the "unzip" command instead of the "gunzip" command.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux User
    Join Date
    Jul 2004
    Posts
    256
    Quote Originally Posted by dt2
    That's the best (and more thorough) answer I've seen on that topic! Many thanks.
    All that information can be found by simply typing
    Code:
    $ man tar
    It shows what flags for bzip'ed files too :P

    Don't take that advice lightly!man and info pages can be a wealth of information, if you just take a minute to look at one.
    --monkey

  6. #5
    Linux Newbie
    Join Date
    May 2004
    Location
    Boston, MA
    Posts
    246
    I don't think that the - is necessary. As far as I've been able to tell, "tar -xvvzf" and "tar xvvzf" are exactly equivalent.

  7. #6
    dt2
    dt2 is offline
    Just Joined!
    Join Date
    Jun 2004
    Location
    UK
    Posts
    88
    well said, monkey8. wasn't trying to downplay the importance of referring to the man pages, especially before posting a question about a command -- rather, i was trying to thank dan@george for taking the time to detail the answer to the question in a clear and newbie-friendly way without forgetting to mention man tar. i think we are all very much on the same page w.r.t. the issue of referring to the man pages.

    dan@george: thanks for the speedy response.

  8. #7
    Linux Newbie
    Join Date
    Nov 2003
    Location
    Syria
    Posts
    181
    well, thanx that was great...

    XT
    Registered Linux User # 368300 at Linux Counter

Posting Permissions

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