查看tar包文件内容的方法

1. tar 文件:

code$ tar tvf etc.tar 
drwxr-xr-x root/root         0 2014-09-12 22:20 etc/
-rw-r--r-- root/root       153 2013-12-15 23:26 etc/inittab
-rw-r--r-- root/root       293 2014-09-12 22:15 etc/fstab

2. tar.gz 文件:

/code$ gzip -dc socket.tar.gz | tar tvf -
drwxrwxr-x charles/charles   0 2014-06-09 07:41 socket/
-rw-rw-r-- charles/charles 1165 2014-06-09 00:03 socket/server6.c
或者:

/code$ tar ztf socket.tar.gz 
socket/
socket/server6.c
socket/client6.c
socket/server.c

3. tar.bz2 文件:

/code$ bzip2 -dc bootchart-0.9.tar.bz2 | tar tvf -
drwxrwxr-x ziga/ziga         0 2005-11-14 01:40 bootchart-0.9/
drwxrwxr-x ziga/ziga         0 2005-11-14 01:40 bootchart-0.9/examples/
-rw-rw-r-- ziga/ziga    120466 2005-11-14 01:40 bootchart-0.9/examples/bootchart.tgz

或者:

/code$ tar -jtf  bootchart-0.9.tar.bz2
bootchart-0.9/
bootchart-0.9/examples/
bootchart-0.9/examples/bootchart.tgz


你可能感兴趣的:(查看tar包文件内容的方法)