In this tutorial, we are going to learn how to view the contents of an Archive and/or Compressed file without actually extracting it in Unix-like operating systems. Before going further, let be clear about Archive and compress files. There is significant difference between both. The Archiving is the process of combining multiple files or folders or both into a single file. In this case, the resulting file is not compressed. The compressing is a method of combining multiple files or folders or both into a single file and finally compress the resulting file. The archive is not a compressed file, but the compressed file can be an archive. Clear? Well, let us get to the topic.
### View The Contents Of An Archive Or Compressed File Without Extracting It
Thanks to Linux community, there are many command line applications are available to do it. Let us going to see some of them with examples.
**1\. Using Vim Editor**
Vim is not just an editor. Using Vim, we can do numerous things. The following command displays the contents of an compressed archive file without decompressing it.
```
$ vim ostechnix.tar.gz
```
![][2]
You can even browse through the archive and open the text files (if there are any) in the archive as well. To open a text file, just put the mouse cursor in-front of the file using arrow keys and hit ENTER to open it.
**2\. Using Tar command**
To list the contents of a tar archive file, run:
```
$ tar -tf ostechnix.tar
ostechnix/
ostechnix/image.jpg
ostechnix/file.pdf
ostechnix/song.mp3
```
Or, use **-v** flag to view the detailed properties of the archive file, such as permissions, file owner, group, creation date etc.
As you can see, the above command displays the contents of the zip file, its permissions, creating date, and percentage of compression etc.
**8. Using Zcat command
**
To view the contents of a compressed archive file without extracting it using **zcat** command, we do:
```
$ zcat ostechnix.tar.gz
```
The zcat is same as “gunzip -c” command. So, you can also use the following command to view the contents of the archive/compressed file:
```
$ gunzip -c ostechnix.tar.gz
```
**9. Using Zless command
**
To view the contents of an archive/compressed file using Zless command, simply do:
```
$ zless ostechnix.tar.gz
```
This command is similar to “less” command where it displays the output page by page.
**10. Using Less command
**
As you might already know, the **less** command can be used to open a file for interactive reading, allowing scrolling and search.
Run the following command to view the contents of an archive/compressed file using less command:
```
$ less ostechnix.tar.gz
```
And, that’s all for now. You know now how to view the contents of an archive of compressed file using various commands in Linux. Hope you find this useful. More good stuffs to come. Stay tuned!