Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to see the contents(list of files and folders) of tar.gz file without extracting it.

Is there any methods of seeing that?

share|improve this question

3 Answers 3

up vote 14 down vote accepted

Run the below command on terminal to see the contents of a tar.gz file without extracting it,

tar -tf filename.tar.gz

enter image description here

share|improve this answer

You can also use vim

vim filename.tar.gz
share|improve this answer
    
This is awesome. You can also see the contents of the files! –  Nico Oct 21 at 13:24

less can also open gz-compressed and uncompressed tar archives. It gives you a lovely ls -l style output too:

$ less ~/src/compiz_0.9.7.8-0ubuntu1.6.debian.tar.gz
drwxrwxr-x 0/0               0 2012-09-21 11:41 debian/
drwxrwxr-x 0/0               0 2012-08-09 13:32 debian/source/
-rw-rw-r-- 0/0              12 2012-08-09 13:32 debian/source/format
-rw-rw-r-- 0/0              25 2012-08-09 13:32 debian/libdecoration0-dev.docs
-rw-rw-r-- 0/0              25 2012-08-09 13:32 debian/compiz-dev.docs
-rw-rw-r-- 0/0             347 2012-08-09 13:32 debian/compiz-core.install
-rw-rw-r-- 0/0             125 2012-08-09 13:32 debian/libdecoration0-dev.install
...

And because it's less, you can scroll through it, search it, etc. However it fails miserably with other compression algorithms (in my experience).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.