Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: List the contents of a compressed file (tar/ tar.gz)  (Read 2523 times)

0 Members and 1 Guest are viewing this topic.

Eby Sebastian

  • Newbie
  • *
  • Posts: 14
  • Karma: +1/-0
List the contents of a compressed file (tar/ tar.gz)
« on: November 03, 2013, 08:18:36 pm »
Sometime you may need to view the contents of files included in the tar file. In such cases, you can run the below commands according to your file format.

List the contents of a tar file

Code: [Select]
[root~]#tar -tvf filename.tar


List the contents of a tar.gz file

Code: [Select]
[root~]#tar -ztvf filename.tar.gz


List the contents of a tar.bz2 file

Code: [Select]
[root~]#tar -jtvf filename.tar.bz2

If the compressed file contains large number of files, then it is better to redirect the command output to a text file. So that you can search for any specific file or check it later.

Code: [Select]
[root~]#tar -tvf filename.tar > finename.txt
Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!