≡ Menu

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

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

Share this tutorial on:

Like this? Follow us on Twitter OR support us by using Patreon

{ 2 comments… add one }
  • Frank September 16, 2010, 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!

  • Jass October 31, 2011, 10:25 am

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

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: