在本教程中,我们将向您展示如何提取tar.gz文件:
tar vxf filename.tar.gz

例

例如,~/Download文件夹中的apache-ant-1.9.4-bin.tar.gz。
$ cd ~ $ pwd /Users/mkyong # Optionally, create a new folder for the archived file. $ mkdir tools $ cd tools $ pwd /Users/mkyong/tools # Copy archived file to an above newly created folder. $ cp ~/Downloads/apache-ant-1.9.4-bin.tar.gz ~/tools # Extracts it $ tar vxf apache-ant-1.9.4-bin.tar.gz x apache-ant-1.9.4/bin/ant x apache-ant-1.9.4/bin/antRun x apache-ant-1.9.4/bin/antRun.pl x apache-ant-1.9.4/bin/complete-ant-cmd.pl x apache-ant-1.9.4/bin/runant.pl x apache-ant-1.9.4/bin/runant.py x apache-ant-1.9.4/ x apache-ant-1.9.4/bin/ ...... $ pwd /Users/mkyong/tools $ ls -lsah 0 drwxr-xr-x@ 15 mkyong staff 510B Nov 22 11:24 apache-ant-1.9.4 10872 -rw-r-----@ 1 mkyong staff 5.3M Oct 29 14:42 apache-ant-1.9.4-bin.tar.gz