原文地址,感谢博主:http://blog.itpub.net/23249684/viewspace-1242060/
[size=medium]首先我创建了一个tar包:
[oracle@goolen test]$ ls -l
total 80084
-rw-r--r-- 1 oracle oinstall 81998360 Jul 30 09:52 test.tar.gz
我们要想解压tar包中一个文件,就需要先知道这个tar包里都有什么些文件:
[oracle@goolen test]$ tar --help | more
Usage: tar [OPTION...] [FILE]...
GNU `tar' saves many files together into a single tape or disk archive, and can
restore individual files from the archive.
Examples:
tar -cf archive.tar foo bar # Create archive.tar from files foo and bar.
tar -tvf archive.tar # List all files in archive.tar verbosely.
tar -xf archive.tar # Extract all files from archive.tar.
-t, --list list the contents of an archive
-t参数可以列出tar包里的所有文件:
[oracle@goolen test]$ tar -tvf test.tar.gz
drwxr-xr-x oracle/oinstall 0 2014-06-24 09:48
[size=medium]首先我创建了一个tar包:
[oracle@goolen test]$ ls -l
total 80084
-rw-r--r-- 1 oracle oinstall 81998360 Jul 30 09:52 test.tar.gz
我们要想解压tar包中一个文件,就需要先知道这个tar包里都有什么些文件:
[oracle@goolen test]$ tar --help | more
Usage: tar [OPTION...] [FILE]...
GNU `tar' saves many files together into a single tape or disk archive, and can
restore individual files from the archive.
Examples:
tar -cf archive.tar foo bar # Create archive.tar from files foo and bar.
tar -tvf archive.tar # List all files in archive.tar verbosely.
tar -xf archive.tar # Extract all files from archive.tar.
-t, --list list the contents of an archive
-t参数可以列出tar包里的所有文件:
[oracle@goolen test]$ tar -tvf test.tar.gz
drwxr-xr-x oracle/oinstall 0 2014-06-24 09:48