Operating System - HP-UX
1819694 Members
4405 Online
109605 Solutions
New Discussion юеВ

What is the way to list files in a gz file?

 
Dan Tingley
Occasional Contributor

What is the way to list files in a gz file?

I made a 11.23 hp-ux gold image for the server, which is a gz file. Now I want to know what is in it. Is there a way to find it out?
7 REPLIES 7
Aashique
Honored Contributor

Re: What is the way to list files in a gz file?

Hi,
You are confusing something. In gzip it compress single file extension will be "gz".

And in tar u can see the list of files.

But the extension must be ".tar"
if your file is a.tar.gz
first gunzip a.tar.gz
then, tar tvf a.tar

with the "t" option you can see the list without extract it.


Thanks & Regards

Aashique
Steven Schweda
Honored Contributor

Re: What is the way to list files in a gz file?

I don't know what's in an "hp-ux gold image",
but you can always try feeding it into
various programs to see if anyone can make
sense of it:

gzip -dc file.gz | tar tfv -

and so on.
Steven Schweda
Honored Contributor

Re: What is the way to list files in a gz file?

> first gunzip a.tar.gz
> then, tar tvf a.tar

You must have _much_ more unused disk space
than I.
Patrick Wallek
Honored Contributor

Re: What is the way to list files in a gz file?

No reason to gunzip the file before using tar on it.

Try this:

gzcat filename | tar -tvf -

(Note there is a space between the 'f' and the second '-')

You could then redirect that output to a file or just pipe it to more.
Dan Tingley
Occasional Contributor

Re: What is the way to list files in a gz file?

I opened a call to hp, that is what they told me and it works for me.

gunzip < file.gz | tar -tvf -
Steven Schweda
Honored Contributor

Re: What is the way to list files in a gz file?

Well, that's three ways to spell it.

The salient fact here is that it's a
gzip-compressed "tar" archive, so if you know
how to deal with one of those, you're left
with only the ever-difficult decision of
exactly how you'd like to run gzip (or gzcat,
or gunzip).
OldSchool
Honored Contributor

Re: What is the way to list files in a gz file?

Option 4: ....or the ever popular GNU tar...