List the contents of tar gz file

tar command is archiving utility. Something, you can retrieve extension .tar.gz or .tar.bz2 file. How to list the contents this without extracting from command line.
The syntax tar command as below:
tar OPTION File_Name
With OPTION:
  • t, --list : List the contents of an archive
  • v : Verbosely list files processed
  • j : Filter archive through bzip2
  • f : filename
 You may reading link as below:

List the contents of .tar.gz file

To use tar command for .tar.gz as following:
$ tar -tvf links-2.12.tar.gz 
The output of links-2.12.tar.gz file as below:
-rwxr--r-- 1000/1000      1215 2001-10-05 14:03 links-2.12/mailcap.pl
-rwxr-xr-- 1000/1000      4654 2015-06-28 22:13 links-2.12/rebuild
-rw-r--r-- 1000/1000       461 2003-05-06 01:10 links-2.12/links_16x16_1.xpm
-rw-r--r-- 1000/1000      2410 2003-05-06 01:10 links-2.12/links_32x32.xpm
-rw-r--r-- 1000/1000      3847 2005-03-01 00:16 links-2.12/links-48x48.xpm
-rw-r--r-- 1000/1000      1045 2015-08-01 04:30 links-2.12/mk-release-os2
-rwxr-xr-x 1000/1000      1574 2015-07-25 23:53 links-2.12/mk-release-win
-rw-r--r-- 1000/1000       978 2015-08-22 22:08 links-2.12/mk-dos
-rw-r--r-- 1000/1000      6413 2015-07-25 23:53 links-2.12/links.nsi
-rw-r--r-- 1000/1000      6521 2015-07-25 23:53 links-2.12/links64.nsi
-rw-r--r-- 1000/1000      4630 2015-09-21 04:37 links-2.12/INSTALL

List content specified 
$ tar -tvf links-2.12.tar.gz | grep links_16x16_1.xpm
The output as below:
-rw-r--r-- 1000/1000       461 2003-05-06 01:10 links-2.12/links_16x16_1.xpm

List the contents of .tar.bz2 file

To use tar command for .tar.bz2 as following: 
$ tar -jtvf links-2.14.tar.bz2
The output as below:
-rwxr--r-- 1000/1000      1215 2001-10-05 14:03 links-2.14/mailcap.pl
-rwxr-xr-- 1000/1000      4654 2016-05-01 21:31 links-2.14/rebuild
-rw-r--r-- 1000/1000       461 2003-05-06 01:10 links-2.14/links_16x16_1.xpm
-rw-r--r-- 1000/1000      2410 2003-05-06 01:10 links-2.14/links_32x32.xpm
-rw-r--r-- 1000/1000      3847 2005-03-01 00:16 links-2.14/links-48x48.xpm
-rw-r--r-- 1000/1000      1048 2016-06-17 05:45 links-2.14/mk-release-os2
-rwxr-xr-x 1000/1000      1647 2016-11-03 00:54 links-2.14/mk-release-win
-rw-r--r-- 1000/1000       967 2016-06-20 01:55 links-2.14/mk-dos
-rw-r--r-- 1000/1000      7334 2016-11-03 00:54 links-2.14/links.nsi
-rw-r--r-- 1000/1000      7444 2016-11-03 00:54 links-2.14/links64.nsi
-rw-r--r-- 1000/1000      4630 2016-11-27 03:58 links-2.14/INSTALL

man page for tar command
$ man tar

Comments

Popular posts from this blog

zimbra some services are not running [Solve problem]

Bash script list all IP addresses connected to Server with Country Information

Zimbra Client host rejected Access denied fixed