Sunday, February 27, 2011

How to list contents of a .tar.gz without unzip

This one should be included in the UNIX system administration FAQ as it is very handy and a common request...More than often we end up with a filled up disk or partition but while deciding whether deleting that massive zip file we forget its real content. Of course, unarchiving it is impossible due to lack of space, and to make things worse FTP and SCP are disabled! A nightmare...But worry not - there is an easy way to inspect the content of a zip, gzip, tar, or bzip archives in Unix.

# To show content of a tar file
tar -tvf foo.tar
# To show content of a gzip file
tar -ztvf foo.tar.gz
# To show content of a bzip file
tar -jtvf foo.tar.bz
Post a Comment