前天有个朋友QQ问我怎么从一个tar压缩包里解压一个文件,而不是全部解压
这几天实在是太忙了,今早抽个时间给他做了个示范,也顺便记录一下,希望能帮到一些朋友。
首先我创建了一个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