Operating System - HP-UX
1819803 Members
3205 Online
109607 Solutions
New Discussion юеВ

How to list files inside .tar archive?

 
SOLVED
Go to solution
Kevin Millar
New Member

How to list files inside .tar archive?

Can someone please post the tar syntax that can be used to list the files inside of a .tar file without exracting the files? Thanks
9 REPLIES 9
spex
Honored Contributor
Solution

Re: How to list files inside .tar archive?

Hi Kevin,

# tar tvf file.tar

PCS
A. Clay Stephenson
Acclaimed Contributor

Re: How to list files inside .tar archive?

The man page will do this but it's quite simple:

tar vtf myfile.tar and because the list is send to stdout:

tar vtf myfile.tar > mylist
or
tar vtf myfile.tar | lp -dmyprinter

also work.
If it ain't broke, I can fix that.
Ivan Krastev
Honored Contributor

Re: How to list files inside .tar archive?

tar -tvf file.tar

regards
Geoff Wild
Honored Contributor

Re: How to list files inside .tar archive?

tar -tvf somefile.tar

tar -tvf somefile.tar |grep "particular.file"

man tar for info

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Kevin Millar
New Member

Re: How to list files inside .tar archive?

Thanks everyone!
A. Clay Stephenson
Acclaimed Contributor

Re: How to list files inside .tar archive?

... and to make it more confusing tar is one of the few UNIX commands that doesn't adhere to the standards so that "tar -vtf myfile.tar" and "tar vtf myfile.tar". The "-" is optional as an argument prefix. This too is explained in the man page.
If it ain't broke, I can fix that.
Steven E. Protter
Exalted Contributor

Re: How to list files inside .tar archive?

Shalom Kevin,

tar -tvf

Even works to tape.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Steven E. Protter
Exalted Contributor

Re: How to list files inside .tar archive?

Sorry about my late post there.

I hit submit, walked away and it bombed.

man tar will give you advanced options or the ability to pull one file out of archive.

Please zero point my posts.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Kevin Millar
New Member

Re: How to list files inside .tar archive?

Thanks for the quick responses all!