LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-13-2014, 06:29 AM   #1
sad
LQ Newbie
 
Registered: Jul 2014
Posts: 9

Rep: Reputation: Disabled
tar.gz


Hi
how can i open a file from " tar.gz " ? I am usig Lubuntu.
 
Old 07-13-2014, 06:32 AM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Hi,

Try
Code:
tar -zxvf example.tar.gz
Kind regards
 
Old 07-13-2014, 08:19 AM   #3
BobKay
Member
 
Registered: Jul 2014
Posts: 39

Rep: Reputation: Disabled
Or more simply,
Code:
tar -xf example.tar.gz
Modern tar is smart enough to figure out on its own if it needs to filter through gzip, bzip2, whatever, on its own so no need for the -z option. Leaving off the -v will suppress the listing of every file extracted; that may or may not be desirable depending on what you're doing.
 
Old 07-13-2014, 10:51 AM   #4
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,299
Blog Entries: 61

Rep: Reputation: Disabled
There's no need for the - any more, so:
Code:
tar xvf filename
or:
Code:
tar xf filename
 
Old 07-13-2014, 11:05 AM   #5
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Old habits die hard.....
 
Old 07-13-2014, 11:59 AM   #6
BobKay
Member
 
Registered: Jul 2014
Posts: 39

Rep: Reputation: Disabled
Quote:
Originally Posted by brianL View Post
There's no need for the - any more, so:
Code:
tar xvf filename
or:
Code:
tar xf filename
Quite right. In fact if memory serves, the - was never needed and in fact that was one of the early criticisms of the tar command; it's "nonstandard" means of specifying option flags.

Quote:
Originally Posted by repo View Post
Old habits die hard.....
Indeed.
 
Old 07-13-2014, 12:05 PM   #7
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
or graphically

Code:
ark filename.tar.gz
 
Old 07-13-2014, 01:07 PM   #8
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,627

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
you open a compressed archive THE EXACT SAME WAY ON LINUX AS YOU DID ON WINDOWS OR APPLES MAC!!!!!!!!!

R-click on is and from the r-click menu select to open/extract it
 
Old 07-13-2014, 01:09 PM   #9
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,299
Blog Entries: 61

Rep: Reputation: Disabled
Quote:
Originally Posted by John VV View Post
you CAN open a compressed archive THE EXACT SAME WAY ON LINUX AS YOU DID ON WINDOWS OR APPLES MAC!!!!!!!!!

R-click on is and from the r-click menu select to open/extract it
Fixed that for you.
 
Old 07-13-2014, 01:43 PM   #10
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 2,557

Rep: Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762
Quote:
Originally Posted by brianL View Post
There's no need for the - any more
Any more? There never was any need.


Quote:
Originally Posted by brianL View Post
Code:
tar xf filename
or

Code:
tar fx filename


P.S. Old style options are awesome like that.
Quote:
Originally Posted by ruario View Post
If you don't use a - in front you can have any order you like for the short options, with the only problem being that options must be the first argument as a group, with the archive name second and the files/folders next. [EDIT]: I have since realised this is not entirely true either, proceed to my later post afterwards for a further clarification of how old style options work

The following are all valid and do exactly the same thing:
Code:
tar cf archive.tar files
tar fc archive.tar files
tar -cf archive.tar files
tar -c -f archive.tar files
tar -f archive.tar -c files
tar --create --file=archive.tar files
tar --file=archive.tar files --create
You can also mix and match as long as you remember to keep the short options without a - as the first argument, e.g.:
Code:
tar f archive.tar -c files
tar c --file=archive.tar files
These are not valid:
Code:
tar -fc archive.tar files
tar c f archive.tar files
tar f archive.tar c files
Quote:
Originally Posted by ruario View Post
Actually without using a - is the "Old Option Style" (how tar has traditionally worked), while with a - is a more modern invention that the tar manual calls the "Short Option Style". In addition there is -- and a keyword (e.g. --file) which they call the "Long Option Style".

Although I prefer "Old Option Style" since it is generally shorter, re-reading the online manual now I realise that I hadn't fully appreciated how it worked and actually explained it incorrectly above. Suppose I wanted to extract archive.tar to the root directory, previously I would have written:

Code:
tar xf archive.tar -C /
I used "Old Option Style" at the beginning and a "Short Option Style" switch at the end. This was because I believed that the second argument had to be the archive. However now I see that this is not true. All of following also work using only "Old Option Style":

Code:
tar Cfx / archive.tar
tar Cxf / archive.tar
tar fCx archive.tar /
tar fxC archive.tar /
tar xCf / archive.tar
tar xfC archive.tar /
The options that take a value must be in the same order as the arguments that come after then, so if 'f' is before 'C' then it is 'archive /' but if 'C' is first then it is '/ archive'. It is logical, though it may take me a little getting used to.

Last edited by ruario; 07-13-2014 at 01:54 PM. Reason: added quotes to my old posts
 
Old 07-14-2014, 02:47 AM   #11
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,299
Blog Entries: 61

Rep: Reputation: Disabled
Ruari has obviously RTFMed more than me.
 
Old 07-14-2014, 03:07 AM   #12
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 2,557

Rep: Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762
Quote:
Originally Posted by brianL View Post
Ruari has obviously RTFMed more than me.
Indeed I have spent some time reading the online GNU Tar Manual ("man tar" is pretty useless).
 
Old 07-14-2014, 03:16 AM   #13
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,299
Blog Entries: 61

Rep: Reputation: Disabled
Quote:
Originally Posted by ruario View Post
Indeed I have spent some time reading the online GNU Tar Manual ("man tar" is pretty useless).
Yeah, from the man tar page itself:
Quote:
BUGS
The GNU folks, in general, abhor man pages, and create info documents instead. The maintainer of tar falls into this category. This man page is neither complete, nor current, and was included in the Debian Linux packaging of tar entirely to reduce the frequency with which the lack of a man page gets reported as a bug in our defect tracking system.
If you really want to understand tar, then you should run info and read the tar info pages, or use the info mode in emacs.
 
Old 07-14-2014, 04:00 AM   #14
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 2,557

Rep: Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762
Yep, the info page is the same as the online manual, so indeed it is very helpful.

Me ... I never fully came to terms with info. It is not so much that info is hard to use, it is just different and not what I expect. Additionally I try to use info so infrequently that I constantly forget the options for navigation. The time it would take me to familiarise myself would be better spent looking up the information online, which is what I tend to do. Especially when I know that most programs and utilities that prefer info are GNU and they always have an online version, thus allowing me to use a web browser which I already understand.

info may be technically better than man but given it never caught on after many years of trying, I wish the GNU teams would focus on getting better content into man, which is still widely used (despite the near universal presence of the internet).

This is one thing I favour from the BSD world. They never went down the info route and so generally have decent man pages. Check out "man bsdtar", while not as long as the GNU tar info content, it contains everything you need to know. Including a very succinct explanation of "bundled-arguments" (their name for what GNU calls "Old Option Style").

Last edited by ruario; 07-14-2014 at 04:01 AM.
 
Old 07-14-2014, 04:09 AM   #15
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
Quote:
Old habits die hard.....
Hehe, ow yea...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 14 10-25-2016 02:48 AM
"Invalid tar magic" error msg. when I try to tar ldmud *.tar file in DSL pixxi451 Linux - Newbie 4 07-04-2010 08:32 AM
BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z) asgarcymed Linux - General 5 12-31-2006 02:53 AM
tar | ssh (tar > .tar) syntax issues EarlMosier Linux - Software 6 12-21-2006 12:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration