How do I list files inside compressed tar ball (gzip’d tar’d) archive?

by on March 7, 2006 · 2 comments· LAST UPDATED March 7, 2006


Tar command provides the option to list files inside compressed tar ball. However mtools includes command called lz which gunzips and shows a listing of a gzip'd tar'd archive without extracting files.

For example, display listing of file called backup.tar.gz type command:

$ lz backup.tar.gz

As you see lz provides a listing of a gzip'd tar'd archive, that is a tar archive compressed with the gzip command. It is not strictly necessary on Debian GNU/Linux (or other Linux/BSD/Solaris oses), because the GNU tar(1) program provides the same capability with the command:

$ tar -tzf backup.tar.gz

Tweet itFacebook itG+ itDownload PDF versionFound an error/typo on this page?

{ 2 comments… read them below or add one }

1 Frank September 16, 2010 at 1:46 pm

Thank you for great advice. I found that lz works well with wildcards, but tar -tzf does not.
For example: tar -tzf *.tar.gz produces the following errors:
tar: file_1.tar.gz: Not found in archive
tar: file_2.tar.gz: Not found in archive

tar: file_n.tar.gz: Not found in archive
tar: Error exit delayed from previous errors

lz *.tar.gz, on the other hand, works great!


2 Jass October 31, 2011 at 10:25 am

I tried the comment in Solaris. It’s not working. Can anyone help me?


Leave a Comment

Tagged as:

Previous Faq:

Next Faq: