Many a times, its better to view what's in the archive before extracting it. Sometimes the stuff compressed together is useless and extracting it might be just a waste of time and energy. Here we will consider both tar and zipped files and will list out the files bundled inside without fully extracting it.
For graphical environments, one can easily view the files inside by using an archive manager, eg. file-roller in GNOME.
For tar files, we can use the "-t" option to state the contents of the file. This options applies to both zip and bzip formats.
[shredder12]$ tar -tf file.tar
[shredder12]$ tar -tf file.tar.gz
[shredder12]$ tar -tf file.tar.bz2
In case of files archived using gzip, we can use the "-l" option of unzip command.
[shredder12]$ unzip -l file.zip