Operating System - HP-UX
1751695 Members
5102 Online
108781 Solutions
New Discussion юеВ

how to see name of the files in tarred and zipped file

 
SOLVED
Go to solution
Shivkumar
Super Advisor

how to see name of the files in tarred and zipped file

Hi,

What is command to see name of the files without un-tarring a tarred and zipped file like: abc.tar.gz

Thanks,
Shiv
6 REPLIES 6
Dennis Handly
Acclaimed Contributor
Solution

Re: how to see name of the files in tarred and zipped file

No, you must gunzip and untar it but you can do it in one step:
gzcat abc.tar.gz | tar -tvf -
Shivkumar
Super Advisor

Re: how to see name of the files in tarred and zipped file

I want to see the file names without untarring and unzipping abc.tar.gz
Patrick Wallek
Honored Contributor

Re: how to see name of the files in tarred and zipped file

Try this:

# gzcat abc.tar.gz | tar -tvf -

This should do what you require.

Note that there is a space between the 'f' and the '-' in the 'tvf -'.
Steven Schweda
Honored Contributor

Re: how to see name of the files in tarred and zipped file

> gzcat abc.tar.gz | tar -tvf -

> I want to see the file names without
> untarring and unzipping abc.tar.gz

What, exactly, was the problem with the first
suggestion?

You might try reading the results of:

man gzip
man tar

to see what it would actually do. Then,
re-complain, if you can find any reason to.


If you think that you can find a way to see
what's in a gzip-compressed "tar" archive
without somehow using gzip and "tar" (or
equivalent programs), then please explain
which supernatural entity you expect to help
you to do that.
Suraj K Sankari
Honored Contributor

Re: how to see name of the files in tarred and zipped file

Hi,
With our un-tar you can see the contant with tar -tvf option.

#tar -cvf to create a tar file
#tar -xvf to extract a tar file
#tar -tvf to see the content of a tar file with out extract it.

For more information see "man tar"

Suraj
Arturo Galbiati
Esteemed Contributor

Re: how to see name of the files in tarred and zipped file

Hi,
gzcat abc.tar.gz | tar -tvf -

HTH,
Art